Skip to content

Commit

Permalink
Added pg db for testing and configured workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayley Ashby committed Apr 19, 2024
1 parent efd311d commit 1995731
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/CI and Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ jobs:
build:
name: Node.js CI
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: ${{ secrets.PG_USER }}
POSTGRES_PASSWORD: ${{ secrets.PG_PW }}
POSTGRES_DB: ${{ secrets.PG_DB }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand All @@ -21,7 +31,13 @@ jobs:
- run: npm run build --if-present
- run: npm test
env:
DB_URL: ${{ secrets.DB_URL }}
NODE_ENV: 'production'
CLIENT_TOKEN: ${{ secrets.CLIENT_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
KANKA_TOKEN: ${{ secrets.KANKA_TOKEN }}
DB_TOKEN: ${{ secrets.DB_TOKEN }}
DB_URL: postgres://postgres:postgres@localhost:5432/test

deploy:
name: Fly Deploy
needs: build
Expand All @@ -34,3 +50,4 @@ jobs:
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
DB_URL: ${{ secrets.DB_URL}}
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import dotenv from 'dotenv';

dotenv.config();
if (process.env.NODE_ENV !== 'production') {
dotenv.config();
}

const { NODE_ENV, CLIENT_TOKEN, CLIENT_ID, KANKA_TOKEN, DB_TOKEN, DB_URL } = process.env;

Expand Down

0 comments on commit 1995731

Please sign in to comment.