fix: config env vars parser + heroku config file

This commit is contained in:
NGPixel
2017-05-15 00:09:44 -04:00
parent 59ce39f033
commit 8b89c2bba7
5 changed files with 25 additions and 38 deletions

View File

@@ -67,8 +67,8 @@ module.exports = (port, spinner) => {
langs,
conf,
runmode: {
staticPort: (process.env.IS_HEROKU || process.env.WIKI_JS_DOCKER),
staticMongo: (!_.isNil(process.env.IS_HEROKU))
staticPort: (process.env.WIKI_JS_HEROKU || process.env.WIKI_JS_DOCKER),
staticMongo: (!_.isNil(process.env.WIKI_JS_HEROKU))
}
})
})

View File

@@ -13,7 +13,7 @@ module.exports = {
return _.replace(
cfg,
(/\$\(([A-Z0-9_]+)\)/g,
(m) => { return process.env[m] })
(fm, m) => { return process.env[m] })
)
}
}

View File

@@ -13,7 +13,7 @@ module.exports = {
* Detect the most appropriate start mode
*/
startDetect: function () {
if (process.env.IS_HEROKU) {
if (process.env.WIKI_JS_HEROKU) {
return this.startInHerokuMode()
} else {
return this.startInBackgroundMode()
@@ -49,21 +49,8 @@ module.exports = {
* Start in Heroku mode
*/
startInHerokuMode: function () {
let self = this
console.info('Initializing Wiki.js for Heroku...')
let herokuStatePath = path.join(__dirname, './app/heroku.json')
return fs.accessAsync(herokuStatePath).then(() => {
require('./server.js')
}).catch(err => {
if (err.code === 'ENOENT') {
console.info('Wiki.js is not configured yet. Launching configuration wizard...')
self.configure(process.env.PORT)
} else {
console.error(err)
process.exit(1)
}
})
require('./server.js')
},
/**
* Stop Wiki.js process(es)