You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
const process = require('process');
|
|
const startServer = require('./startServer');
|
|
const getSSLArgsFromCommandLine = require('./getSSLSettings.js').getSSLArgsFromCommandLine;
|
|
const getDefaultSSLArgs = require('./getSSLSettings').getDefaultSSLArgs;
|
|
|
|
const runApp = () => {
|
|
process.on('uncaughtException', function(e) {
|
|
console.error('Wetty Error: ' + e);
|
|
});
|
|
|
|
const SSLSettings = getSSLArgsFromCommandLine();
|
|
startServer(SSLSettings, {
|
|
onConnectionAccepted: () => {
|
|
console.log((new Date()) + ' Connection accepted.');
|
|
},
|
|
onServerListen: isHttp => {
|
|
console.log('https on port ' + SSLSettings.port);
|
|
},
|
|
onTerminalStart: (term, sshuser) => {
|
|
console.log((new Date()) + " PID=" + term.pid + " STARTED on behalf of user=" + sshuser)
|
|
},
|
|
onTerminalExit: term => {
|
|
console.log((new Date()) + " PID=" + term.pid + " ENDED");
|
|
},
|
|
});
|
|
};
|
|
|
|
const startSSH = (settings, hooks) => {
|
|
const defaultSSHSettings = Object.assign(getDefaultSSLArgs(), settings);
|
|
return startServer(defaultSSHSettings, hooks || {});
|
|
};
|
|
|
|
module.exports = {
|
|
runApp,
|
|
startSSH,
|
|
};
|
|
|