Removed settings file
This commit is contained in:
parent
22c43c6ce6
commit
4582d8694f
|
@ -1,7 +1,14 @@
|
|||
|
||||
var jsonfile = require('jsonfile')
|
||||
const args = require('args-parser')(process.argv)
|
||||
|
||||
const defaults = {
|
||||
'webroot': '',
|
||||
'serverroot': '',
|
||||
'accessUrl': '',
|
||||
'autoJoin': false,
|
||||
'autoJoinServer': '',
|
||||
'autoJoinRoom': '',
|
||||
'autoJoinPassword': ''
|
||||
}
|
||||
module.exports = function () {
|
||||
const fields = [
|
||||
'webroot',
|
||||
|
@ -12,21 +19,11 @@ module.exports = function () {
|
|||
'autoJoinRoom',
|
||||
'autoJoinPassword'
|
||||
]
|
||||
// Load and export our settings in preference of ENV -> settings.json -> example_settings.json
|
||||
// Load and export our settings in preference of ENV -> args
|
||||
let output = {}
|
||||
let settingsFile
|
||||
try {
|
||||
settingsFile = require('./settings.json')
|
||||
} catch (e) {
|
||||
console.log('Creating default settings.json')
|
||||
let defaults = require('./example_settings.json')
|
||||
jsonfile.writeFileSync('./settings.json', defaults)
|
||||
settingsFile = defaults
|
||||
}
|
||||
let defaults = require('./example_settings.json')
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
let setting = fields[i]
|
||||
output[setting] = args[setting] || process.env[setting] || settingsFile[setting] || defaults[setting]
|
||||
output[setting] = args[setting] || process.env[setting] || defaults[setting]
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
var git = require('git-rev-sync')
|
||||
|
||||
console.log('Production env', process.env)
|
||||
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"',
|
||||
gitHash: '"' + git.short() + '"',
|
||||
|
|
Loading…
Reference in New Issue