fix: config env vars parser + heroku config file
This commit is contained in:
parent
59ce39f033
commit
8b89c2bba7
@ -8,13 +8,13 @@
|
||||
# Title of this site
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
title: Wiki
|
||||
title: $(WIKI_TITLE)
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Full public path to the site, without the trailing slash
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
host: https://YOURAPP.herokuapp.com/
|
||||
host: $(WIKI_HOST)
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Port the main server should listen to (80 by default)
|
||||
@ -44,13 +44,13 @@ uploads:
|
||||
# ---------------------------------------------------------------------
|
||||
# Possible values: en, de, es, fr, ko, pt or ru
|
||||
|
||||
lang: en
|
||||
lang: $(WIKI_LANG)
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Site Authentication
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
public: false
|
||||
public: $(WIKI_PUBLIC)
|
||||
|
||||
auth:
|
||||
defaultReadAccess: false
|
||||
@ -97,7 +97,7 @@ auth:
|
||||
# ---------------------------------------------------------------------
|
||||
# Use a long and unique random string (256-bit keys are perfect!)
|
||||
|
||||
sessionSecret: 1234567890abcdefghijklmnopqrstuvxyz
|
||||
sessionSecret: $(WIKI_SESSION_KEY)
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Database Connection String
|
||||
@ -110,16 +110,16 @@ db: $(MONGODB_URI)
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
git:
|
||||
url: https://github.com/Organization/Repo
|
||||
branch: master
|
||||
url: $(WIKI_GIT_URL)
|
||||
branch: $(WIKI_GIT_BRANCH)
|
||||
auth:
|
||||
|
||||
# Type: basic or ssh
|
||||
type: ssh
|
||||
type: basic
|
||||
|
||||
# Only for Basic authentication:
|
||||
username: marty
|
||||
password: MartyMcFly88
|
||||
username: $(WIKI_GIT_USERNAME)
|
||||
password: $(WIKI_GIT_PASSWORD)
|
||||
|
||||
# Only for SSH authentication:
|
||||
privateKey: /etc/wiki/keys/git.pem
|
||||
@ -127,10 +127,10 @@ git:
|
||||
sslVerify: true
|
||||
|
||||
# Default email to use as commit author
|
||||
serverEmail: marty@example.com
|
||||
serverEmail: $(WIKI_SERVER_EMAIL)
|
||||
|
||||
# Whether to use user email as author in commits
|
||||
showUserEmail: true
|
||||
showUserEmail: $(WIKI_SHOW_USER_EMAIL)
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Features
|
||||
|
@ -137,7 +137,7 @@ const tasks = {
|
||||
if (err.code === 'ENOENT') {
|
||||
ora.text = 'First-time install, creating a new config.yml...'
|
||||
let sourceConfigFile = path.join(installDir, 'config.sample.yml')
|
||||
if (process.env.IS_HEROKU) {
|
||||
if (process.env.WIKI_JS_HEROKU) {
|
||||
sourceConfigFile = path.join(__dirname, 'configs/config.heroku.yml')
|
||||
} else if (process.env.WIKI_JS_DOCKER) {
|
||||
sourceConfigFile = path.join(__dirname, 'configs/config.docker.yml')
|
||||
@ -152,7 +152,11 @@ const tasks = {
|
||||
})
|
||||
},
|
||||
startConfigurationWizard () {
|
||||
if (process.stdout.isTTY && !process.env.WIKI_JS_DOCKER) {
|
||||
if (process.env.WIKI_JS_HEROKU) {
|
||||
console.info('Wiki.js has been installed and is configured to use Heroku configuration.')
|
||||
} else if (process.env.WIKI_JS_DOCKER) {
|
||||
console.info('Docker environment detected. Skipping setup wizard auto-start.')
|
||||
} else if (process.stdout.isTTY) {
|
||||
inquirer.prompt([{
|
||||
type: 'list',
|
||||
name: 'action',
|
||||
@ -202,11 +206,7 @@ const tasks = {
|
||||
})
|
||||
})
|
||||
} else {
|
||||
if (!process.env.IS_HEROKU && !process.env.WIKI_JS_DOCKER) {
|
||||
console.info(colors.cyan('[WARNING] Non-interactive terminal detected. You must manually start the configuration wizard using the command: node wiki configure'))
|
||||
} else {
|
||||
console.info('Container environment detected. Skipping setup wizard auto-start. OK.')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ if (!process.env.IS_HEROKU && !process.env.WIKI_JS_DOCKER) {
|
||||
' \\/ \\/ |_|_|\\_\\_(_)/ |___/ \n' +
|
||||
' |__/\n'))
|
||||
} else {
|
||||
console.info('=-=-= WIKI.JS =-=-=')
|
||||
console.info('> WIKI.JS [Installing...]')
|
||||
}
|
||||
|
||||
let ora = require('ora')({ text: 'Initializing...', spinner: 'dots12' }).start()
|
||||
|
@ -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))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -13,7 +13,7 @@ module.exports = {
|
||||
return _.replace(
|
||||
cfg,
|
||||
(/\$\(([A-Z0-9_]+)\)/g,
|
||||
(m) => { return process.env[m] })
|
||||
(fm, m) => { return process.env[m] })
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* Stop Wiki.js process(es)
|
||||
|
Loading…
Reference in New Issue
Block a user