🚧 Add support to server

This commit is contained in:
brunosimon
2017-11-13 13:50:59 +01:00
parent a1b80b9a98
commit 36f843c31d
+28 -5
View File
@@ -26,6 +26,9 @@ class App
console.log()
this.setConfig()
if(this.config.server && !this.config.host)
{
this.setSite(
() =>
{
@@ -33,17 +36,18 @@ class App
this.setProjects()
},
() =>
{
console.log('app'.green.bold + ' - ' + 'keppler seems to be running already'.cyan)
},
() =>
{
console.log('error'.red)
console.log('app'.green.bold + ' - ' + 'keppler seems to be running already'.cyan)
}
)
}
if(!this.config.server)
{
this.setWatcher()
}
}
/**
* Set config
@@ -108,6 +112,18 @@ class App
default: 99999,
type: 'number'
})
.option('server', {
alias: 's',
describe: 'Start keppler has server',
default: false,
type: 'boolean'
})
.option('host', {
alias: 'h',
describe: 'Host, in case it\'s not a local',
default: '',
type: 'string'
})
.argv
config.debug = args.debug
@@ -118,6 +134,8 @@ class App
config.test = args.test
config.initialSend = args['initial-send']
config.maxFileSize = args['max-file-size']
config.server = args.server
config.host = args.host
if(config.name === '')
{
@@ -131,8 +149,13 @@ class App
}
}
if(config.host === '')
{
config.host = false
}
// Custom
config.domain = `http://${ip.address()}${config.port !== 80 ? ':' + config.port : ''}`
config.domain = `http://${config.host ? config.host : ip.address()}${config.port !== 80 ? ':' + config.port : ''}`
// Save
this.config = config