"use strict"; require("typings-global"); var plugins = require("./npmci.plugins"); var sshRegex = /^(.*)\|?(.*)\|?(.*)/; var sshInstance; exports.ssh = function () { sshInstance = new plugins.smartssh.SshInstance(); plugins.smartparam.forEachMinimatch(process.env, "NPMCI_SSHKEY_*", exports.evaluateSshkey); sshInstance.writeToDisk(); }; 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); }; //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnNzaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFM0MsSUFBSSxRQUFRLEdBQUcscUJBQXFCLENBQUE7QUFDcEMsSUFBSSxXQUF3QyxDQUFDO0FBRWxDLFdBQUcsR0FBRztJQUNiLFdBQVcsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsV0FBVyxFQUFFLENBQUM7SUFDakQsT0FBTyxDQUFDLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFDLGdCQUFnQixFQUFDLHNCQUFjLENBQUMsQ0FBQztJQUNqRixXQUFXLENBQUMsV0FBVyxFQUFFLENBQUM7QUFDOUIsQ0FBQyxDQUFDO0FBRVMsc0JBQWMsR0FBRyxVQUFDLGVBQWU7SUFDeEMsSUFBSSxXQUFXLEdBQUcsUUFBUSxDQUFDLElBQUksQ0FBQyx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