From 4df9b70c952692f5a6474e25f8d8827cd13b80d5 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 16 Jan 2024 17:42:46 +0800 Subject: [PATCH] Fix for detecting environment --- packages/api/src/util.ts | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/packages/api/src/util.ts b/packages/api/src/util.ts index a048de93f..7835abf54 100755 --- a/packages/api/src/util.ts +++ b/packages/api/src/util.ts @@ -109,19 +109,6 @@ export interface BackendEnv { } } -/*** - * Checks if we are running on Google App Engine. - * See https://cloud.google.com/appengine/docs/standard/nodejs/runtime#environment_variables - */ -export function isAppEngine(): boolean { - return ( - process.env.GOOGLE_CLOUD_PROJECT !== undefined && - process.env.GAE_INSTANCE !== undefined && - process.env.GAE_SERVICE !== undefined && - process.env.GAE_VERSION !== undefined - ) -} - const nullableEnvVars = [ 'INTERCOM_TOKEN', 'INTERCOM_SECRET_KEY', @@ -172,10 +159,7 @@ const nullableEnvVars = [ ] // Allow some vars to be null/empty /* If not in GAE and Prod/QA/Demo env (f.e. on localhost/dev env), allow following env vars to be null */ -if ( - !isAppEngine() && - ['prod', 'qa', 'demo'].indexOf(process.env.API_ENV || '') === -1 -) { +if (process.env.API_ENV == 'local') { nullableEnvVars.push(...['GCS_UPLOAD_BUCKET']) } @@ -248,7 +232,7 @@ export function getEnv(from: Dict): BackendEnv { host: parse('JAEGER_HOST'), } const dev = { - isLocal: !isAppEngine(), + isLocal: parse('API_ENV') == 'local', } const queue = { location: parse('PUPPETEER_QUEUE_LOCATION'),