🚧 Add support to server

This commit is contained in:
brunosimon
2017-11-13 13:50:59 +01:00
parent a1b80b9a98
commit 36f843c31d
+40 -17
View File
@@ -26,23 +26,27 @@ class App
console.log() console.log()
this.setConfig() this.setConfig()
this.setSite(
() =>
{
this.setSocket()
this.setProjects()
},
() =>
{
console.log('app'.green.bold + ' - ' + 'keppler seems to be running already'.cyan)
},
() =>
{
console.log('error'.red)
}
)
this.setWatcher() if(this.config.server && !this.config.host)
{
this.setSite(
() =>
{
this.setSocket()
this.setProjects()
},
() =>
{
console.log('error'.red)
console.log('app'.green.bold + ' - ' + 'keppler seems to be running already'.cyan)
}
)
}
if(!this.config.server)
{
this.setWatcher()
}
} }
/** /**
@@ -108,6 +112,18 @@ class App
default: 99999, default: 99999,
type: 'number' 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 .argv
config.debug = args.debug config.debug = args.debug
@@ -118,6 +134,8 @@ class App
config.test = args.test config.test = args.test
config.initialSend = args['initial-send'] config.initialSend = args['initial-send']
config.maxFileSize = args['max-file-size'] config.maxFileSize = args['max-file-size']
config.server = args.server
config.host = args.host
if(config.name === '') if(config.name === '')
{ {
@@ -131,8 +149,13 @@ class App
} }
} }
if(config.host === '')
{
config.host = false
}
// Custom // 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 // Save
this.config = config this.config = config