Skip to content

Commit

Permalink
add in FORCE_SSL env var
Browse files Browse the repository at this point in the history
  • Loading branch information
apricot13 committed Jan 2, 2024
1 parent 03c3c98 commit 3bb2e57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
environment:
NODE_ENV: production
DB_URI: mongodb://mongo:27017/outpost_api
FORCE_SSL: true
networks:
- outpost_api_internal_network
- outpost_api_external_network
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ connect(() =>

server.set("trust proxy", 1)

// outside of dev environment if we send FORCE_SSL then SSL is forced
if (!isDevelopment) {
server.use(forceSSL)
if (process.env.FORCE_SSL && process.env.FORCE_SSL.toLowerCase() === "true") {
server.use(forceSSL)
}
}

server.use(
rateLimit({
windowMs: 15 * 60 * 1000,
Expand Down

0 comments on commit 3bb2e57

Please sign in to comment.