From e050d8374b8bcb959c67f8b899091e8e3a09b5b9 Mon Sep 17 00:00:00 2001 From: Alex McLeod Date: Sun, 11 Feb 2024 10:40:36 +1300 Subject: [PATCH] set default working directory for backend deployment worflow and reverted conf error throw --- .github/workflows/deploy-dev.yml | 4 +++- packages/backend/src/app.ts | 3 +++ packages/backend/src/email/emailService.ts | 4 +++- packages/backend/src/payment/payment-controller.ts | 3 +++ packages/backend/tools/getToken.js | 3 +++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 7096976..6ec5234 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -6,6 +6,9 @@ jobs: deploy-backend: runs-on: ubuntu-latest environment: DEV + defaults: + run: + working-directory: ./packages/backend permissions: contents: 'read' id-token: 'write' @@ -35,7 +38,6 @@ jobs: uses: 'google-github-actions/deploy-appengine@v2' with: project_id: wdcc-aspa-dev - working_directory: ./packages/backend deploy-frontend: runs-on: ubuntu-latest diff --git a/packages/backend/src/app.ts b/packages/backend/src/app.ts index 0502d14..f63b381 100644 --- a/packages/backend/src/app.ts +++ b/packages/backend/src/app.ts @@ -13,6 +13,9 @@ import { verifyAdmin } from './middleware/verifyAdmin'; import firebase_admin from 'firebase-admin'; const conf = dotenv.config(); +if (conf.error) { + throw conf.error; +} const app = express(); const port = process.env.PORT || 5000; diff --git a/packages/backend/src/email/emailService.ts b/packages/backend/src/email/emailService.ts index f0ca1c7..8cb053a 100644 --- a/packages/backend/src/email/emailService.ts +++ b/packages/backend/src/email/emailService.ts @@ -4,7 +4,9 @@ import fs from 'fs'; import path from 'path'; const conf = dotenv.config(); - +if (conf.error) { + throw conf.error; +} const apiKey = process.env.SENDGRID_API_KEY; const fromEmail = process.env.SENDGRID_FROM_EMAIL; if (apiKey == null) { diff --git a/packages/backend/src/payment/payment-controller.ts b/packages/backend/src/payment/payment-controller.ts index 5d11ae0..366d1e4 100644 --- a/packages/backend/src/payment/payment-controller.ts +++ b/packages/backend/src/payment/payment-controller.ts @@ -6,6 +6,9 @@ import Stripe from 'stripe'; import dotenv from 'dotenv'; const conf = dotenv.config(); +if (conf.error) { + throw conf.error; +} const secret = process.env.STRIPE_SECRET_KEY; if (!secret) diff --git a/packages/backend/tools/getToken.js b/packages/backend/tools/getToken.js index 849ab8d..eb1ced8 100644 --- a/packages/backend/tools/getToken.js +++ b/packages/backend/tools/getToken.js @@ -2,6 +2,9 @@ // import dotenv from "dotenv"; const dotenv = require('dotenv'); const conf = dotenv.config(); +if (conf.error) { + throw conf.error; +} var myHeaders = new Headers(); myHeaders.append('Content-Type', 'application/json');