@adastradev/serverless-discovery-plugin
Version:
Serverless plugin to register/de-register endpoints upon deploy and remove command hooks
25 lines (24 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PluginIAMCredentials = void 0;
var ACCESS_KEY = 'accessKeyId';
var SECRET_KEY = 'secretAccessKey';
var PluginIAMCredentials = /** @class */ (function () {
function PluginIAMCredentials(config, environment) {
if (environment === void 0) { environment = process.env; }
if (this.hasNonEmptyValue(config, ACCESS_KEY) && this.hasNonEmptyValue(config, SECRET_KEY)) {
this.accessKeyId = config[ACCESS_KEY] || '';
this.secretAccessKey = config[SECRET_KEY] || '';
}
else {
this.accessKeyId = environment.AWS_ACCESS_KEY_ID || '';
this.secretAccessKey = environment.AWS_SECRET_ACCESS_KEY || '';
}
this.type = 'IAM';
}
PluginIAMCredentials.prototype.hasNonEmptyValue = function (config, key) {
return (config && config[key] && config[key].length > 0);
};
return PluginIAMCredentials;
}());
exports.PluginIAMCredentials = PluginIAMCredentials;