Make local DEV work out of the box

This commit is contained in:
MartinBraquet
2025-09-20 23:51:28 +02:00
parent d7c95e2ae0
commit 84a437772d
22 changed files with 138 additions and 121 deletions

View File

@@ -1,14 +1,14 @@
import * as admin from 'firebase-admin'
import {getLocalEnv, initAdmin} from 'shared/init-admin'
import {loadSecretsToEnv, getServiceAccountCredentials} from 'common/secrets'
import {initAdmin} from 'shared/init-admin'
import {loadSecretsToEnv} from 'common/secrets'
import {log} from 'shared/utils'
import {LOCAL_DEV} from "common/envs/constants";
import {IS_LOCAL} from "common/envs/constants";
import {METRIC_WRITER} from 'shared/monitoring/metric-writer'
import {listen as webSocketListen} from 'shared/websockets/server'
log('Api server starting up....')
if (LOCAL_DEV) {
if (IS_LOCAL) {
initAdmin()
} else {
const projectId = process.env.GOOGLE_CLOUD_PROJECT
@@ -21,9 +21,10 @@ if (LOCAL_DEV) {
METRIC_WRITER.start()
import {app} from './app'
import {getServiceAccountCredentials} from "shared/firebase-utils";
const credentials = LOCAL_DEV
? getServiceAccountCredentials(getLocalEnv())
const credentials = IS_LOCAL
? getServiceAccountCredentials()
: // No explicit credentials needed for deployed service.
undefined
@@ -37,6 +38,5 @@ const startupProcess = async () => {
})
webSocketListen(httpServer, '/ws')
log('Server started successfully')
}
startupProcess()
startupProcess().then(r => log('Server started successfully'))