2016-06-23 20:22:03 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-global");
|
|
|
|
var plugins = require("./npmci.plugins");
|
2016-06-24 00:54:55 +00:00
|
|
|
var sshRegex = /^(.*)\|?(.*)\|?(.*)/;
|
|
|
|
var sshInstance;
|
2016-06-23 20:22:03 +00:00
|
|
|
exports.ssh = function () {
|
2016-06-24 00:54:55 +00:00
|
|
|
sshInstance = new plugins.smartssh.SshInstance();
|
2016-06-23 20:22:03 +00:00
|
|
|
plugins.smartparam.forEachMinimatch(process.env, "NPMCI_SSHKEY_*", exports.evaluateSshkey);
|
2016-06-24 00:54:55 +00:00
|
|
|
sshInstance.sync("to");
|
2016-06-23 20:22:03 +00:00
|
|
|
};
|
2016-06-24 00:54:55 +00:00
|
|
|
exports.evaluateSshkey = function (sshkeyEnvVarArg) {
|
|
|
|
var resultArray = sshRegex.exec(sshkeyEnvVarArg);
|
|
|
|
var sshKey = new plugins.smartssh.SshKey();
|
|
|
|
if (resultArray[1] && resultArray[1] != "undefined")
|
|
|
|
sshKey.privateKeyBase64 = resultArray[1];
|
|
|
|
var publicKey;
|
|
|
|
if (resultArray[2] && resultArray[2] != "undefined")
|
|
|
|
sshKey.publicKeyBase64 = resultArray[2];
|
|
|
|
var host;
|
|
|
|
if (resultArray[3] && resultArray[3] != "undefined")
|
|
|
|
sshKey.host = resultArray[1];
|
|
|
|
sshInstance.addKey(sshKey);
|
2016-06-23 20:22:03 +00:00
|
|
|
};
|
|
|
|
|
2016-06-24 00:54:55 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnNzaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFM0MsSUFBSSxRQUFRLEdBQUcscUJBQXFCLENBQ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