From ff4698caf5d8d1941255dff6df2ecc3dfd9edde3 Mon Sep 17 00:00:00 2001 From: "Cheng-Han, Wu" Date: Fri, 22 Apr 2016 03:33:09 +0800 Subject: [PATCH] Update to support DOMAIN and URL_PATH environment variables --- README.md | 2 ++ lib/config.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e1cc4464..9f5fbb1ca 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ Environment variables (will overwrite other server configs) | variables | example values | description | | --------- | ------ | ----------- | | NODE_ENV | `production` or `development` | set current environment (will apply correspond settings in the `config.json`) | +| DOMAIN | `hackmd.io` | domain name | +| URL_PATH | `hackmd` | sub url path, like `www.example.com/` | | PORT | `80` | web app port | | DEBUG | `true` or `false` | set debug mode, show more logs | diff --git a/lib/config.js b/lib/config.js index 386b08852..7028f29ac 100644 --- a/lib/config.js +++ b/lib/config.js @@ -7,8 +7,8 @@ var config = require(path.join(__dirname, '..', 'config.json'))[env]; var debug = process.env.DEBUG ? (process.env.DEBUG === 'true') : ((typeof config.debug === 'boolean') ? config.debug : (env === 'development')); // url -var domain = config.domain || 'localhost'; -var urlpath = config.urlpath || ''; +var domain = process.env.DOMAIN || config.domain || ''; +var urlpath = process.env.URL_PATH || config.urlpath || ''; var port = process.env.PORT || config.port || 3000; var alloworigin = config.alloworigin || ['localhost'];