summaryrefslogtreecommitdiff
path: root/lib/config/index.js
diff options
context:
space:
mode:
authorSheogorath2018-06-24 13:22:51 +0200
committerSheogorath2018-06-24 13:40:18 +0200
commitb242b59db4b27bac345d98f982def7c54955c84c (patch)
treee5f429d4bcc01f4fa41c472fed713d98b73918f9 /lib/config/index.js
parent12d11f3f3f61c43aebfe77d83a17b850598000e6 (diff)
Rename environment variables and add legacy support.
As we are no longer HackMD the short tag `HMD` doesn't match anymore. We move it to the matching prefix `CMD` and inform our users about the change. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
Diffstat (limited to '')
-rw-r--r--lib/config/index.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/config/index.js b/lib/config/index.js
index 79330443..760d94a1 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -33,6 +33,7 @@ merge(config, debugConfig)
merge(config, packageConfig)
merge(config, fileConfig)
merge(config, require('./oldEnvironment'))
+merge(config, require('./hackmdEnvironment'))
merge(config, require('./environment'))
merge(config, require('./dockerSecret'))
@@ -122,6 +123,11 @@ for (let i = keys.length; i--;) {
}
}
+// Notify users about the prefix change and inform them they use legacy prefix for environment variables
+if (Object.keys(process.env).toString().indexOf('HMD_') !== -1) {
+ logger.warn('Using legacy HMD prefix for environment variables. Please change your variables in future. For details see: https://github.com/hackmdio/codimd#environment-variables-will-overwrite-other-server-configs')
+}
+
// Generate session secret if it stays on default values
if (config.sessionSecret === 'secret') {
logger.warn('Session secret not set. Using random generated one. Please set `sessionSecret` in your config.js file. All users will be logged out.')