introduce hostname in configuration
This commit is contained in:
parent
2d06c7c616
commit
0219b03769
1 changed files with 6 additions and 1 deletions
|
@ -1,9 +1,11 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const URL = require('url')
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
firstrun: true,
|
firstrun: true,
|
||||||
baseurl: "http://localhost:13120",
|
baseurl: '',
|
||||||
|
hostname: '',
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 13120
|
port: 13120
|
||||||
|
@ -24,6 +26,9 @@ let config = {
|
||||||
const configContent = fs.readFileSync(config_path)
|
const configContent = fs.readFileSync(config_path)
|
||||||
config = Object.assign(config, JSON.parse(configContent))
|
config = Object.assign(config, JSON.parse(configContent))
|
||||||
config.firstrun = false
|
config.firstrun = false
|
||||||
|
if (!config.hostname) {
|
||||||
|
config.hostname = new URL.URL(config.baseurl).hostname
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
config.firstrun = true
|
config.firstrun = true
|
||||||
console.info('> Configuration file does not exists, running setup..')
|
console.info('> Configuration file does not exists, running setup..')
|
||||||
|
|
Loading…
Reference in a new issue