feat: heroku compatibility

This commit is contained in:
Nick 2019-06-01 21:38:21 -04:00
parent e49cb03882
commit 9f58a08fcb
5 changed files with 9 additions and 24 deletions

View File

@ -46,4 +46,6 @@ USER node
EXPOSE 3000
# HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD curl -f http://localhost/healthz
CMD ["node", "server"]

View File

@ -15,7 +15,7 @@ const init = {
const chokidar = require('chokidar')
global.DEV = true
global.WP_CONFIG = require('./dev/webpack/webpack.dev.js')
global.WP_CONFIG = require('./webpack/webpack.dev.js')
global.WP = webpack(global.WP_CONFIG)
global.WP_DEV = {
devMiddleware: require('webpack-dev-middleware')(global.WP, {
@ -25,7 +25,7 @@ const init = {
}
global.WP_DEV.devMiddleware.waitUntilValid(() => {
console.info(chalk.yellow.bold('>>> Starting Wiki.js in DEVELOPER mode...'))
require('./server')
require('../server')
process.stdin.setEncoding('utf8')
process.stdin.on('data', data => {
@ -84,22 +84,8 @@ const init = {
process.removeAllListeners('unhandledRejection')
process.removeAllListeners('uncaughtException')
require('./server')
require('../server')
}
}
require('yargs') // eslint-disable-line no-unused-expressions
.usage('Usage: node $0 <cmd> [args]')
.command({
command: 'dev',
desc: 'Start in Developer Mode',
handler: argv => {
init.dev()
}
})
.recommendCommands()
.demandCommand(1, 'You must provide one of the accepted commands above.')
.help()
.version()
.epilogue('Read the docs at https://docs-beta.requarks.io/dev')
.argv
init.dev()

View File

@ -6,14 +6,11 @@
"main": "wiki.js",
"scripts": {
"start": "node server",
"dev": "node wiki dev",
"dev": "node dev",
"build": "webpack --profile --config dev/webpack/webpack.prod.js",
"watch": "webpack --config dev/webpack/webpack.dev.js",
"test": "eslint --format codeframe --ext .js,.vue . && pug-lint server/views && jest"
},
"bin": {
"wiki": "wiki.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Requarks/wiki.git"

View File

@ -48,7 +48,7 @@ module.exports = {
appconfig = _.defaultsDeep(appconfig, appdata.defaults.config)
if (appconfig.port < 1) {
if (appconfig.port < 1 || process.env.HEROKU) {
appconfig.port = process.env.PORT || 80
}

View File

@ -24,7 +24,7 @@ module.exports = {
let self = this
let dbClient = null
let dbConfig = (!_.isEmpty(process.env.WIKI_DB_CONNSTR)) ? process.env.WIKI_DB_CONNSTR : {
let dbConfig = (!_.isEmpty(process.env.DATABASE_URL)) ? process.env.DATABASE_URL : {
host: WIKI.config.db.host,
user: WIKI.config.db.user,
password: WIKI.config.db.pass,