diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 9b9e5710..7d515512 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -44,6 +44,7 @@ jobs: PRODUCTION_DOMAIN: ${{secrets.PRODUCTION_DOMAIN}} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + NODE_ENV: ${{ github.event_name == 'pull_request' && 'staging' || 'production' }} - name: Comment staging URL uses: marocchino/sticky-pull-request-comment@v2 diff --git a/api/src/helpers/mongo.ts b/api/src/helpers/mongo.ts index 4e664b8a..6932dd23 100644 --- a/api/src/helpers/mongo.ts +++ b/api/src/helpers/mongo.ts @@ -12,7 +12,7 @@ const client = new MongoClient(process.env.MONGO_URL, { useNewUrlParser: true, u /** * Database name to use in mongo */ -const DB_NAME = 'peterPortalDB'; +const DB_NAME = process.env.NODE_ENV == 'production' ? 'peterPortalDB' : 'peterPortalDevDB'; /** * Collection names that we are using */ diff --git a/api/src/types/environment.d.ts b/api/src/types/environment.d.ts index 1d3f3a8c..5f7311b0 100644 --- a/api/src/types/environment.d.ts +++ b/api/src/types/environment.d.ts @@ -5,7 +5,7 @@ declare global { */ interface ProcessEnv { MONGO_URL: string; - NODE_ENV: 'development' | 'production'; + NODE_ENV: 'development' | 'production' | 'staging'; PORT?: string; PUBLIC_API_URL: string; PUBLIC_API_GRAPHQL_URL: string;