1 | import { __awaiter, __generator } from "tslib";
|
2 | import { CredentialsProviderError } from "@aws-sdk/property-provider";
|
3 | export var fromEnv = function (envVarSelector) {
|
4 | return function () { return __awaiter(void 0, void 0, void 0, function () {
|
5 | var config;
|
6 | return __generator(this, function (_a) {
|
7 | try {
|
8 | config = envVarSelector(process.env);
|
9 | if (config === undefined) {
|
10 | throw new Error();
|
11 | }
|
12 | return [2, config];
|
13 | }
|
14 | catch (e) {
|
15 | throw new CredentialsProviderError(e.message || "Cannot load config from environment variables with getter: ".concat(envVarSelector));
|
16 | }
|
17 | return [2];
|
18 | });
|
19 | }); };
|
20 | };
|