mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-16 02:09:36 +00:00
store client ips in bigquery table
This commit is contained in:
@@ -15,11 +15,14 @@ export async function archive(gameRecord: GameRecord) {
|
||||
end: new Date(gameRecord.endTimestampMS),
|
||||
duration_seconds: gameRecord.durationSeconds,
|
||||
number_turns: gameRecord.num_turns,
|
||||
usernames: gameRecord.usernames,
|
||||
game_mode: gameRecord.gameConfig.gameType,
|
||||
winner: null,
|
||||
difficulty: gameRecord.gameConfig.difficulty,
|
||||
map: gameRecord.gameConfig.gameMap,
|
||||
players: gameRecord.players.map(p => ({
|
||||
username: p.username,
|
||||
ip: p.ip,
|
||||
})),
|
||||
};
|
||||
|
||||
await bigquery
|
||||
@@ -29,6 +32,8 @@ export async function archive(gameRecord: GameRecord) {
|
||||
|
||||
console.log(`wrote game metadata to BigQuery: ${gameRecord.id}`);
|
||||
if (gameRecord.turns.length > 0) {
|
||||
// Players will see this so make sure to clear PII.
|
||||
gameRecord.players.forEach(p => p.ip = "REDACTED")
|
||||
console.log(`writing game ${gameRecord.id} to gcs`)
|
||||
const bucket = storage.bucket("openfront-games");
|
||||
const file = bucket.file(gameRecord.id);
|
||||
|
||||
Reference in New Issue
Block a user