Skip to content

Commit

Permalink
Use config for origin
Browse files Browse the repository at this point in the history
  • Loading branch information
morrigan committed Mar 17, 2020
1 parent 21469c7 commit 5c62a22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ BACKEND_CONTAINER_NAME=nodejs-ts-starter-backend
# Docker image tag
IMAGE_TAG=latest

# Frontend app
ORIGIN=https://analytics.hactar.app

# Database settings

# Default user that will be created on first start
Expand All @@ -32,4 +35,5 @@ EMAIL_API_KEY=
EMAIL_API_URL=https://api.sendinblue.com/v3/smtp/email
EMAIL_UPTIME_NOTIF_TEMPLATE_ID=2
# Cron like sintax
UPTIME_NOTIF_RECURRENCE=0 * * * *
UPTIME_NOTIF_RECURRENCE=0 * * * *

2 changes: 1 addition & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class App implements Service {
router.use(cors() as any);
} else {
router.use(cors({
origin: "https://analytics.hactar.app"
origin: config.origin,
}) as any);
}

Expand Down
1 change: 1 addition & 0 deletions src/Config/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const config = Object.freeze({
port: process.env.DB_PORT || 5432,
user: process.env.DB_USER || "nodefactory",
},
origin: process.env.ORIGIN || "https://analytics.hactar.app",
env: process.env.NODE_ENV || "dev",
port: env.SERVER_PORT || 3000,
jwtKey: process.env.JWT_KEY || "nodefactory",
Expand Down

0 comments on commit 5c62a22

Please sign in to comment.