Skip to content

Commit

Permalink
removed cors from express (#43)
Browse files Browse the repository at this point in the history
* removed cors from express

* Caddyfile + VITE_AWS_DOMAIN

---------

Co-authored-by: Derek Roberts <[email protected]>
  • Loading branch information
jazzgrewal and DerekRoberts authored Oct 5, 2023
1 parent b26436b commit 4e50f8a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
8 changes: 0 additions & 8 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const express = require('express');
const cors = require('cors');
const dotenv =require('dotenv');
const indexRoutes = require("./routes/indexRoutes");
const mailRoutes = require("./routes/mailRoutes");
Expand All @@ -9,14 +8,7 @@ dotenv.config({
path: './.env'
})
const app = express();

// Configure CORS options
const corsOptions = {
origin: ['http://localhost:3000', 'https://nr-results-exam-test-frontend.apps.silver.devops.gov.bc.ca/'],
methods: ['GET','POST'], // Specify the allowed HTTP methods
};
app.use(express.json());
app.use(cors(corsOptions));

app.use('/api/', indexRoutes);
app.use('/api/mail', mailRoutes);
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ version: '3.9'
x-common: &common
depends_on: ["backend"]
environment:
VITE_AWS_DOMAIN: prod-fam-user-pool-domain.auth.ca-central-1.amazoncognito.com
VITE_BACKEND_URL: http://backend:5000
VITE_CHES_FROM_EMAIL : [email protected]
VITE_CHES_ADMIN_EMAIL : [email protected]
Expand Down
2 changes: 1 addition & 1 deletion frontend/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

handle /env.js {
header Content-Type "text/javascript"
respond `window.config = {"VITE_USER_POOLS_ID":"{$VITE_USER_POOLS_ID}","VITE_USER_POOLS_WEB_CLIENT_ID":"{$VITE_USER_POOLS_WEB_CLIENT_ID}","VITE_REDIRECT_SIGN_OUT":"{$VITE_REDIRECT_SIGN_OUT}","VITE_ZONE":"{$VITE_ZONE}","VITE_CHES_FROM_EMAIL":"{$VITE_CHES_FROM_EMAIL}","VITE_CHES_ADMIN_EMAIL":"{$VITE_CHES_ADMIN_EMAIL}","VITE_BACKEND_URL":"{$VITE_BACKEND_URL}"};`
respond `window.config = {"VITE_AWS_DOMAIN":"{$VITE_AWS_DOMAIN}","VITE_USER_POOLS_ID":"{$VITE_USER_POOLS_ID}","VITE_USER_POOLS_WEB_CLIENT_ID":"{$VITE_USER_POOLS_WEB_CLIENT_ID}","VITE_REDIRECT_SIGN_OUT":"{$VITE_REDIRECT_SIGN_OUT}","VITE_ZONE":"{$VITE_ZONE}","VITE_CHES_FROM_EMAIL":"{$VITE_CHES_FROM_EMAIL}","VITE_CHES_ADMIN_EMAIL":"{$VITE_CHES_ADMIN_EMAIL}","VITE_BACKEND_URL":"{$VITE_BACKEND_URL}"};`
}

handle_path /* {
Expand Down
2 changes: 1 addition & 1 deletion frontend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ parameters:
- name: VITE_ZONE
value: DEV
- name: VITE_AWS_DOMAIN
value: "test-fam-user-pool-domain.auth.ca-central-1.amazoncognito.com"
value: "prod-fam-user-pool-domain.auth.ca-central-1.amazoncognito.com"
- name: VITE_CHES_FROM_EMAIL
value: "[email protected]"
- name: VITE_CHES_ADMIN_EMAIL
Expand Down

0 comments on commit 4e50f8a

Please sign in to comment.