webssh2/index.js
billchurch bc19432dfa housekeeping
Move bulk of server .js file files to /server, all client related files
live in /client (including /public), webpack scripts now live in
/scripts, cleanup of paths in /client/src/js/index.js and webpack.js.
2018-02-16 23:48:00 -05:00

25 lines
631 B
JavaScript

// index.js
/*
* WebSSH2 - Web to SSH2 gateway
* Bill Church - https://github.com/billchurch/WebSSH2 - May 2017
*
*/
'use strict'
var config = require('./server/app').config
var server = require('./server/app').server
server.listen({ host: config.listen.ip, port: config.listen.port
})
server.on('error', function (err) {
if (err.code === 'EADDRINUSE') {
config.listen.port++
console.warn('WebSSH2 Address in use, retrying on port ' + config.listen.port)
setTimeout(function () {
server.listen(config.listen.port)
}, 250)
} else {
console.log('WebSSH2 server.listen ERROR: ' + err.code)
}
})