Fix exception when no SSH stuff is configured

This commit is contained in:
Bryan Ashby 2018-11-12 22:05:36 -07:00
parent 516116f83e
commit 74b03fe846
1 changed files with 8 additions and 0 deletions

View File

@ -241,6 +241,10 @@ exports.getModule = class SSHServerModule extends LoginServerModule {
createServer() { createServer() {
const config = Config(); const config = Config();
if(true != config.loginServers.ssh.enabled) {
return;
}
const serverConf = { const serverConf = {
hostKeys : [ hostKeys : [
{ {
@ -269,6 +273,10 @@ exports.getModule = class SSHServerModule extends LoginServerModule {
listen() { listen() {
const config = Config(); const config = Config();
if(true != config.loginServers.ssh.enabled) {
return true; // no server, but not an error
}
const port = parseInt(config.loginServers.ssh.port); const port = parseInt(config.loginServers.ssh.port);
if(isNaN(port)) { if(isNaN(port)) {
Log.error( { server : ModuleInfo.name, port : config.loginServers.ssh.port }, 'Cannot load server (invalid port)' ); Log.error( { server : ModuleInfo.name, port : config.loginServers.ssh.port }, 'Cannot load server (invalid port)' );