Skip to content

Commit 1634d5c

Browse files
committed
Add on/off env var for HSTS
1 parent 56411ca commit 1634d5c

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Environment variables (will overwrite other server configs)
154154
| HMD_S3_SECRET_ACCESS_KEY | no example | AWS secret key |
155155
| HMD_S3_REGION | `ap-northeast-1` | AWS S3 region |
156156
| HMD_S3_BUCKET | no example | AWS S3 bucket name |
157+
| HMD_HSTS_ENABLE | ` true` | set to enable [HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security) if HTTPS is also enabled (default is ` true`) |
157158

158159
Application settings `config.json`
159160
---

app.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"description": "Specify database type. See sequelize available databases. Default using postgres",
2424
"value": "postgres"
2525
},
26-
26+
"HMD_HSTS_ENABLE": {
27+
"description": "whether to also use HSTS if HTTPS is enabled",
28+
"required": false
29+
},
2730
"HMD_DOMAIN": {
2831
"description": "domain name",
2932
"required": false

lib/config/environment.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ module.exports = {
88
port: process.env.HMD_PORT,
99
urladdport: toBooleanConfig(process.env.HMD_URL_ADDPORT),
1010
usessl: toBooleanConfig(process.env.HMD_USESSL),
11+
hsts: {
12+
enable: toBooleanConfig(process.env.HMD_HSTS_ENABLE),
13+
},
1114
protocolusessl: toBooleanConfig(process.env.HMD_PROTOCOL_USESSL),
1215
alloworigin: process.env.HMD_ALLOW_ORIGIN ? process.env.HMD_ALLOW_ORIGIN.split(',') : undefined,
1316
usecdn: toBooleanConfig(process.env.HMD_USECDN),

0 commit comments

Comments
 (0)