How to use the @aws-sdk/credential-provider-env.fromEnv function in @aws-sdk/credential-provider-env

To help you get started, we’ve selected a few @aws-sdk/credential-provider-env examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-sdk-js-v3 / packages / credential-provider-node / src / index.ts View on Github external
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
  );
}

@aws-sdk/credential-provider-env

AWS credential provider that sources credentials from known environment variables

Apache-2.0
Latest version published 2 days ago

Package Health Score

98 / 100
Full package analysis

Popular @aws-sdk/credential-provider-env functions