added docker stuff and updated next.js to ^7.0.0

This commit is contained in:
JJ Kasper
2018-09-21 15:17:55 -05:00
parent 2230f72160
commit 56f9ee318f
62 changed files with 16686 additions and 11907 deletions

View File

@@ -3,14 +3,19 @@ const fs = require('fs')
const path = require('path')
const crypto = require('crypto')
const secret = crypto.randomBytes(256).toString('hex')
const { NODE_ENV } = process.env
let confFile = 'default.json'
const isProd = process.env.NODE_ENV === 'production'
const confFile = (isProd ? 'production' : 'default') + '.json'
const config = require('./config/' + confFile)
const configPath = path.join(__dirname, 'config', confFile)
if (NODE_ENV && NODE_ENV.toLowerCase() === 'production') {
confFile = 'production.json'
// if in production check if secret exists and -f switch is set
if (isProd && config.authentication && config.authentication.secret) {
if (!process.argv.some(arg => arg === '-f')) {
return console.log(
'Secret already exists, not updating. Use -f to force update'
)
}
}
let config = require('./config/' + confFile)
let configPath = path.join(__dirname, 'config', confFile)
if (!config.authentication) {
config.authentication = { secret }