From d22957d292661ef10ea539f49725c388b3237dc9 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Sat, 16 Mar 2024 12:04:27 -0700 Subject: [PATCH 1/2] chore: read GH Secrets to set env vars --- .github/workflows/platformDeploy.yml | 3 +++ desktop/main.ts | 2 +- src/CONFIG.ts | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 4d6597334447..91e244a0ed7c 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -157,6 +157,8 @@ jobs: APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + GCP_GEOLOCATION_API_KEY: $${{ secrets.GCP_GEOLOCATION_API_KEY_PRODUCTION }} + - name: Build staging desktop app if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }} @@ -168,6 +170,7 @@ jobs: APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + GCP_GEOLOCATION_API_KEY: $${{ secrets.GCP_GEOLOCATION_API_KEY_STAGING }} iOS: name: Build and deploy iOS diff --git a/desktop/main.ts b/desktop/main.ts index cbc12d9d2608..6e14d661b345 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -21,7 +21,7 @@ const {DESKTOP_SHORTCUT_ACCELERATOR, LOCALES} = CONST; // Setup google api key in process environment, we are setting it this way intentionally. It is required by the // geolocation api (window.navigator.geolocation.getCurrentPosition) to work on desktop. // Source: https://github.com/electron/electron/blob/98cd16d336f512406eee3565be1cead86514db7b/docs/api/environment-variables.md#google_api_key -process.env.GOOGLE_API_KEY = CONFIG.GOOGLE_GEOLOCATION_API_KEY; +process.env.GOOGLE_API_KEY = CONFIG.GCP_GEOLOCATION_API_KEY; app.setName('New Expensify'); diff --git a/src/CONFIG.ts b/src/CONFIG.ts index 37da65f0c305..76ea18d37d5f 100644 --- a/src/CONFIG.ts +++ b/src/CONFIG.ts @@ -21,7 +21,7 @@ const secureExpensifyUrl = Url.addTrailingForwardSlash(get(Config, 'SECURE_EXPEN const useNgrok = get(Config, 'USE_NGROK', 'false') === 'true'; const useWebProxy = get(Config, 'USE_WEB_PROXY', 'true') === 'true'; const expensifyComWithProxy = getPlatform() === 'web' && useWebProxy ? '/' : expensifyURL; -const googleGeolocationAPIKey = get(Config, 'GOOGLE_GEOLOCATION_API_KEY', 'AIzaSyBqg6bMvQU7cPWDKhhzpYqJrTEnSorpiLI'); +const googleGeolocationAPIKey = get(Config, 'GCP_GEOLOCATION_API_KEY', ''); // Throw errors on dev if config variables are not set correctly if (ENVIRONMENT === CONST.ENVIRONMENT.DEV) { @@ -94,5 +94,5 @@ export default { WEB_CLIENT_ID: '921154746561-gpsoaqgqfuqrfsjdf8l7vohfkfj7b9up.apps.googleusercontent.com', IOS_CLIENT_ID: '921154746561-s3uqn2oe4m85tufi6mqflbfbuajrm2i3.apps.googleusercontent.com', }, - GOOGLE_GEOLOCATION_API_KEY: googleGeolocationAPIKey, + GCP_GEOLOCATION_API_KEY: googleGeolocationAPIKey, } as const; From 88503aa6728bdddb9d526f96ee137c4531bce490 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 18 Mar 2024 16:12:17 -0700 Subject: [PATCH 2/2] chore: use the staging GCP key for ad hoc desktop builds --- .github/workflows/testBuild.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 3f02430f3c1f..fc9e75e626d3 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -265,6 +265,7 @@ jobs: APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + GCP_GEOLOCATION_API_KEY: $${{ secrets.GCP_GEOLOCATION_API_KEY_STAGING }} web: name: Build and deploy Web