UNPKG

tooltwist

Version:
27 lines (23 loc) 893 B
var Config = require('./config'), spawn = require('child_process').spawn; exports.login = function() { var config = Config.getConfig(); if (config.mode != 'deploy') { console.log('Sorry, the login command can only be used when mode="deploy".'); process.exit(1); } if (!config.deploy || !config.deploy.servers || config.deploy.servers.length < 1) { console.log('\n\tError: cannot proceed without \'config.deploy.servers\' defined in ' + Config.CONFIG_FILE + '\n'); process.exit(1); } var server = config.deploy.servers[0]; if (!server.host || server.host === '') { console.log('\n\tError: cannot proceed without \'config.deploy.host\' defined in ' + Config.CONFIG_FILE + '\n'); process.exit(1); } var host = server.host; // -o "StrictHostKeyChecking no" var arg1 = 'tooltwist@' + host; console.log('ssh ' + arg1); spawn('ssh', [ arg1 ], { stdio: 'inherit' }); }