remove node_modules and .gitignore them
This commit is contained in:
-5
@@ -1,5 +0,0 @@
|
||||
import { chain, memoize } from "@smithy/property-provider";
|
||||
import { fromEnv } from "./fromEnv";
|
||||
import { fromSharedConfigFiles } from "./fromSharedConfigFiles";
|
||||
import { fromStatic } from "./fromStatic";
|
||||
export const loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => memoize(chain(fromEnv(environmentVariableSelector), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
import { CredentialsProviderError } from "@smithy/property-provider";
|
||||
export const fromEnv = (envVarSelector) => async () => {
|
||||
try {
|
||||
const config = envVarSelector(process.env);
|
||||
if (config === undefined) {
|
||||
throw new Error();
|
||||
}
|
||||
return config;
|
||||
}
|
||||
catch (e) {
|
||||
throw new CredentialsProviderError(e.message || `Cannot load config from environment variables with getter: ${envVarSelector}`);
|
||||
}
|
||||
};
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
import { CredentialsProviderError } from "@smithy/property-provider";
|
||||
import { getProfileName, loadSharedConfigFiles } from "@smithy/shared-ini-file-loader";
|
||||
export const fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
|
||||
const profile = getProfileName(init);
|
||||
const { configFile, credentialsFile } = await loadSharedConfigFiles(init);
|
||||
const profileFromCredentials = credentialsFile[profile] || {};
|
||||
const profileFromConfig = configFile[profile] || {};
|
||||
const mergedProfile = preferredFile === "config"
|
||||
? { ...profileFromCredentials, ...profileFromConfig }
|
||||
: { ...profileFromConfig, ...profileFromCredentials };
|
||||
try {
|
||||
const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
|
||||
const configValue = configSelector(mergedProfile, cfgFile);
|
||||
if (configValue === undefined) {
|
||||
throw new Error();
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
catch (e) {
|
||||
throw new CredentialsProviderError(e.message || `Cannot load config for profile ${profile} in SDK configuration files with getter: ${configSelector}`);
|
||||
}
|
||||
};
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
import { fromStatic as convertToProvider } from "@smithy/property-provider";
|
||||
const isFunction = (func) => typeof func === "function";
|
||||
export const fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : convertToProvider(defaultValue);
|
||||
-1
@@ -1 +0,0 @@
|
||||
export * from "./configLoader";
|
||||
Reference in New Issue
Block a user