Skip to content

Commit

Permalink
set default working directory for backend deployment worflow and reve…
Browse files Browse the repository at this point in the history
…rted conf error throw
  • Loading branch information
alexwillmcleod committed Feb 10, 2024
1 parent 84b8f40 commit e050d83
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/src/email/emailService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/payment/payment-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/tools/getToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit e050d83

Please sign in to comment.