Skip to content

Commit ff4698c

Browse files
committed
Update to support DOMAIN and URL_PATH environment variables
1 parent 13d61fe commit ff4698c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ Environment variables (will overwrite other server configs)
7878
| variables | example values | description |
7979
| --------- | ------ | ----------- |
8080
| NODE_ENV | `production` or `development` | set current environment (will apply correspond settings in the `config.json`) |
81+
| DOMAIN | `hackmd.io` | domain name |
82+
| URL_PATH | `hackmd` | sub url path, like `www.example.com/<URL_PATH>` |
8183
| PORT | `80` | web app port |
8284
| DEBUG | `true` or `false` | set debug mode, show more logs |
8385

lib/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ var config = require(path.join(__dirname, '..', 'config.json'))[env];
77
var debug = process.env.DEBUG ? (process.env.DEBUG === 'true') : ((typeof config.debug === 'boolean') ? config.debug : (env === 'development'));
88

99
// url
10-
var domain = config.domain || 'localhost';
11-
var urlpath = config.urlpath || '';
10+
var domain = process.env.DOMAIN || config.domain || '';
11+
var urlpath = process.env.URL_PATH || config.urlpath || '';
1212
var port = process.env.PORT || config.port || 3000;
1313
var alloworigin = config.alloworigin || ['localhost'];
1414

0 commit comments

Comments
 (0)