Compare commits

..

2 Commits

Author SHA1 Message Date
Kayne Ruse 168bc695b6 Tweaked WEB_ORIGIN 2022-07-26 11:49:34 +01:00
Kayne Ruse a197073bb1 Fixed origin issue in production environment 2022-07-26 11:07:32 +01:00
5 changed files with 9 additions and 5 deletions
+1
View File
@@ -2,6 +2,7 @@ WEB_PROTOCOL=http
WEB_ADDRESS=localhost WEB_ADDRESS=localhost
WEB_RESET_ADDRESS=localhost/reset WEB_RESET_ADDRESS=localhost/reset
WEB_PORT=3200 WEB_PORT=3200
WEB_ORIGIN=http://localhost:3001
DB_HOSTNAME=database DB_HOSTNAME=database
DB_DATABASE=auth DB_DATABASE=auth
+4 -1
View File
@@ -29,6 +29,8 @@ const question = (prompt, def = null) => {
(async () => { (async () => {
//project configuration //project configuration
const appName = await question('App Name', 'auth'); const appName = await question('App Name', 'auth');
const appWebProtocol = await question('Web Protocol', 'https');
const appWebOrigin = await question('Web Origin', `${appWebProtocol}://example.com`); //TODO: clean these up properly
const appWebAddress = await question('Web Addr', `${appName}.example.com`); const appWebAddress = await question('Web Addr', `${appName}.example.com`);
const postValidationHookArray = await question('Post Validation Hook Array', ''); const postValidationHookArray = await question('Post Validation Hook Array', '');
const resetAddress = await question('Reset Addr', `example.com/reset`); const resetAddress = await question('Reset Addr', `example.com/reset`);
@@ -69,7 +71,8 @@ services:
- "traefik.http.routers.${appName}router.service=${appName}service@docker" - "traefik.http.routers.${appName}router.service=${appName}service@docker"
- "traefik.http.services.${appName}service.loadbalancer.server.port=${appPort}" - "traefik.http.services.${appName}service.loadbalancer.server.port=${appPort}"
environment: environment:
- WEB_PROTOCOL=https - WEB_PROTOCOL=${appWebProtocol}
- WEB_ORIGIN=${appWebOrigin}
- WEB_ADDRESS=${appWebAddress} - WEB_ADDRESS=${appWebAddress}
- HOOK_POST_VALIDATION_ARRAY=${postValidationHookArray} - HOOK_POST_VALIDATION_ARRAY=${postValidationHookArray}
- WEB_RESET_ADDRESS=${resetAddress} - WEB_RESET_ADDRESS=${resetAddress}
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "auth-server", "name": "auth-server",
"version": "1.6.0", "version": "1.6.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "auth-server", "name": "auth-server",
"version": "1.6.0", "version": "1.6.2",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "auth-server", "name": "auth-server",
"version": "1.6.0", "version": "1.6.2",
"description": "An API centric auth server. Uses Sequelize and mariaDB by default.", "description": "An API centric auth server. Uses Sequelize and mariaDB by default.",
"main": "server/server.js", "main": "server/server.js",
"scripts": { "scripts": {
+1 -1
View File
@@ -13,7 +13,7 @@ app.use(express.json());
app.use(cors({ app.use(cors({
credentials: true, credentials: true,
origin: [`${process.env.WEB_PROTOCOL}://${process.env.WEB_ADDRESS}`], origin: [`${process.env.WEB_ORIGIN}`],
allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Set-Cookie'], allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Set-Cookie'],
exposedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Set-Cookie'], exposedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'Set-Cookie'],
})); }));