Commit 59ce39f0 authored by NGPixel's avatar NGPixel

fix: config env vars parsing

parent 20ef07be
...@@ -103,7 +103,7 @@ sessionSecret: 1234567890abcdefghijklmnopqrstuvxyz ...@@ -103,7 +103,7 @@ sessionSecret: 1234567890abcdefghijklmnopqrstuvxyz
# Database Connection String # Database Connection String
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
db: $(MONGO_URI) db: $(MONGODB_URI)
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
# Git Connection Info # Git Connection Info
......
{ {
"name": "wiki.js", "name": "wiki.js",
"version": "1.0.0-beta.12", "version": "1.0.0-beta.12.1",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "install.js", "main": "install.js",
"scripts": { "scripts": {
......
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
parseConfigValue (cfg) { parseConfigValue (cfg) {
return _.replace( return _.replace(
cfg, cfg,
(/\$\([A-Z0-9_]+\)/g, (/\$\(([A-Z0-9_]+)\)/g,
(m) => { return process.env[m] }) (m) => { return process.env[m] })
) )
} }
......
...@@ -4,15 +4,7 @@ const fs = require('fs') ...@@ -4,15 +4,7 @@ const fs = require('fs')
const yaml = require('js-yaml') const yaml = require('js-yaml')
const _ = require('lodash') const _ = require('lodash')
const path = require('path') const path = require('path')
const cfgHelper = require('../helpers/config')
const deepMap = (obj, iterator, context) => {
return _.transform(obj, (result, val, key) => {
result[key] = _.isObject(val)
? deepMap(val, iterator, context)
: iterator.call(context, val, key, obj)
})
}
_.mixin({ deepMap })
/** /**
* Load Application Configuration * Load Application Configuration
...@@ -32,10 +24,8 @@ module.exports = (confPaths) => { ...@@ -32,10 +24,8 @@ module.exports = (confPaths) => {
try { try {
appconfig = yaml.safeLoad( appconfig = yaml.safeLoad(
_.replace( cfgHelper.parseConfigValue(
fs.readFileSync(confPaths.config, 'utf8'), fs.readFileSync(confPaths.config, 'utf8')
(/\$\([A-Z0-9_]+\)/g,
(m) => { return process.env[m] })
) )
) )
appdata = yaml.safeLoad(fs.readFileSync(confPaths.data, 'utf8')) appdata = yaml.safeLoad(fs.readFileSync(confPaths.data, 'utf8'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment