WIPP
This commit is contained in:
parent
7e5515a873
commit
b16d11045c
10 changed files with 368 additions and 550 deletions
63
lib/app.js
63
lib/app.js
|
|
@ -9,7 +9,7 @@ const plugins = require('./plugins')
|
|||
const logger = require('./logger')
|
||||
var argv = require('minimist')(process.argv.slice(2))
|
||||
|
||||
const configManager = require('./config-manager')
|
||||
const settingsLoader = require('./settings-loader')
|
||||
const options = require('./options')
|
||||
|
||||
const devMode = argv.dev || argv.http || options.http
|
||||
|
|
@ -35,46 +35,43 @@ function runOnce () {
|
|||
const seedPath = options.seedPath || './seeds/seed.txt'
|
||||
plugins.init(seedPath)
|
||||
|
||||
return configManager.load()
|
||||
.then(config => {
|
||||
return plugins.configure(config)
|
||||
.then(() => {
|
||||
plugins.startPolling()
|
||||
plugins.startCheckingNotification()
|
||||
return settingsLoader.settings()
|
||||
.then(settings => {
|
||||
plugins.startPolling()
|
||||
plugins.startCheckingNotification(settings.config)
|
||||
|
||||
const httpsServerOptions = {
|
||||
key: fs.readFileSync(options.keyPath),
|
||||
cert: fs.readFileSync(options.certPath),
|
||||
requestCert: true
|
||||
}
|
||||
const httpsServerOptions = {
|
||||
key: fs.readFileSync(options.keyPath),
|
||||
cert: fs.readFileSync(options.certPath),
|
||||
requestCert: true
|
||||
}
|
||||
|
||||
const server = devMode
|
||||
? http.createServer(app)
|
||||
: https.createServer(httpsServerOptions, app)
|
||||
const server = devMode
|
||||
? http.createServer(app)
|
||||
: https.createServer(httpsServerOptions, app)
|
||||
|
||||
const port = 3000
|
||||
const localPort = 3030
|
||||
const localServer = http.createServer(localApp)
|
||||
const port = 3000
|
||||
const localPort = 3030
|
||||
const localServer = http.createServer(localApp)
|
||||
|
||||
if (options.devMode) logger.info('In dev mode')
|
||||
if (options.devMode) logger.info('In dev mode')
|
||||
|
||||
const opts = {
|
||||
app,
|
||||
localApp,
|
||||
devMode,
|
||||
plugins
|
||||
}
|
||||
const opts = {
|
||||
app,
|
||||
localApp,
|
||||
devMode,
|
||||
plugins
|
||||
}
|
||||
|
||||
routes.init(opts)
|
||||
routes.init(opts)
|
||||
|
||||
server.listen(port, () => {
|
||||
console.log('lamassu-server listening on port ' +
|
||||
port + ' ' + (devMode ? '(http)' : '(https)'))
|
||||
})
|
||||
server.listen(port, () => {
|
||||
console.log('lamassu-server listening on port ' +
|
||||
port + ' ' + (devMode ? '(http)' : '(https)'))
|
||||
})
|
||||
|
||||
localServer.listen(localPort, 'localhost', () => {
|
||||
console.log('lamassu-server listening on local port ' + localPort)
|
||||
})
|
||||
localServer.listen(localPort, 'localhost', () => {
|
||||
console.log('lamassu-server listening on local port ' + localPort)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue