Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function defaultProvider(
configuration: RegionProviderConfiguration = {}
): Provider {
return memoize(
chain(fromEnv(configuration), fromSharedConfigFiles(configuration))
);
}
export function defaultProvider(
init: FromIniInit & RemoteProviderInit & FromProcessInit = {}
): CredentialProvider {
const { profile = process.env[ENV_PROFILE] } = init;
const providerChain = profile
? fromIni(init)
: chain(fromEnv(), fromIni(init), fromProcess(init), remoteProvider(init));
return memoize(
providerChain,
credentials =>
credentials.expiration !== undefined &&
credentials.expiration - getEpochTs() < 300,
credentials => credentials.expiration !== undefined
);
}