Browse Source

fix: config was not parsed properly

NGPixel 8 years ago
parent
commit
6ae6d3382d
3 changed files with 12 additions and 3 deletions
  1. 1 0
      package.json
  2. 7 3
      server/libs/config.js
  3. 4 0
      yarn.lock

+ 1 - 0
package.json

@@ -119,6 +119,7 @@
     "through2": "^2.0.3",
     "through2": "^2.0.3",
     "validator": "^7.0.0",
     "validator": "^7.0.0",
     "validator-as-promised": "^1.0.2",
     "validator-as-promised": "^1.0.2",
+    "vue-template-es2015-compiler": "^1.5.2",
     "winston": "^2.3.1",
     "winston": "^2.3.1",
     "yargs": "^8.0.1"
     "yargs": "^8.0.1"
   },
   },

+ 7 - 3
server/libs/config.js

@@ -31,9 +31,13 @@ module.exports = (confPaths) => {
   let appdata = {}
   let appdata = {}
 
 
   try {
   try {
-    appconfig = yaml.safeLoad(_.deepMap(fs.readFileSync(confPaths.config, 'utf8'), c => {
-      return _.replace(c, (/\$\([A-Z0-9_]+\)/g, (m) => { return process.env[m] }))
-    }))
+    appconfig = yaml.safeLoad(
+      _.replace(
+        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'))
     appdata.regex = require(confPaths.dataRegex)
     appdata.regex = require(confPaths.dataRegex)
   } catch (ex) {
   } catch (ex) {

+ 4 - 0
yarn.lock

@@ -6855,6 +6855,10 @@ vue-template-compiler@^2.3.3:
     de-indent "^1.0.2"
     de-indent "^1.0.2"
     he "^1.1.0"
     he "^1.1.0"
 
 
+vue-template-es2015-compiler@^1.5.2:
+  version "1.5.2"
+  resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.5.2.tgz#a0a6c50c941d2a4abda963f2f42c337ac450ee95"
+
 vue@^2.3.3:
 vue@^2.3.3:
   version "2.3.3"
   version "2.3.3"
   resolved "https://registry.yarnpkg.com/vue/-/vue-2.3.3.tgz#d1eaa8fde5240735a4563e74f2c7fead9cbb064c"
   resolved "https://registry.yarnpkg.com/vue/-/vue-2.3.3.tgz#d1eaa8fde5240735a4563e74f2c7fead9cbb064c"