1.2.57 • Published 2 years ago

@imaware/secretenv v1.2.57

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

secretenv

NodeJS utility for automatically resolving environment variables to secret values.

Docs

Automatically generated docs located in ./docs.md.

Supported Secret Providers

  • GCP Secrets
  • AWS SSM Parameter Store
  • AWS Secrets Manager (SecretString only)
  • Vault
  • Azure Key Vault

Usage

In your code's initialization logic, simply call:

await resolveEnv()

The function resolveEnv returns a Promise which resolves once all environment variables have been processed (and resolved if necessary).

Environment variables that should be resolved from remote secret storage sources follow a given pattern for each source type (see src/secretenv/resolvers/<provider>.ts for patterns). If any environment variables match these patterns, secretenv will attempt to resolve them from their respective providers, and replace them in the environment with their resolved values.

The resolveEnv function presumes that valid credentials for the target provider are available. If they are not, it will throw authentication errors.

secretenv will throw errors if:

  • No authentication is present for a provider
  • Credentials do not have permissions to access the secret resource from the provider
  • The secret resource does not exist

secretenv will not throw errors if:

  • The value of the resolved secret is undefined or an empty string

GCP Secrets

GCP secrets should be referenced by this pattern:

/^gcp-secrets:\/\/projects\/(?<gcp_project>[^/]+)\/secrets\/(?<secret_name>[^/]+)\/versions\/(?<version>[^/]+)$/

AWS SSM Parameter Store

AWS SSM Parameters should be referenced by this pattern:

/^aws-ssm:\/\/arn:aws:ssm:(?<region>[^/]+):(?<account_id>[^/]+):parameter\/(?<parameter_id>[^:]+)(?<encrypted>:encrypted)?$/

The :encrypted suffix specifies whether the SSM Parameter is KMS encrypted or not.

AWS Secrets Manager

AWS Secrets Manager SecretStrings should be referenced by this pattern:

/^aws-secrets:\/\/arn:aws:secretsmanager:(?<region>[^/]+):(?<account_id>[^/]+):secret:(?<secret_id>[a-zA-Z0-9/_+=.@-]+)(?<stage>:stage:(?<version_stage>[a-zA-Z0-9]+))?(?<version>:version:(?<version_id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))?$/

*Only AWS Secrets of type SecretString are supported.

1.2.57

2 years ago

1.2.41

2 years ago

1.2.42

2 years ago

1.2.40

2 years ago

1.2.45

2 years ago

1.2.46

2 years ago

1.2.43

2 years ago

1.2.44

2 years ago

1.2.49

2 years ago

1.2.47

2 years ago

1.2.48

2 years ago

1.2.52

2 years ago

1.2.53

2 years ago

1.2.50

2 years ago

1.2.51

2 years ago

1.2.56

2 years ago

1.2.54

2 years ago

1.2.55

2 years ago

1.2.28

3 years ago

1.2.29

2 years ago

1.2.30

2 years ago

1.2.31

2 years ago

1.2.34

2 years ago

1.2.35

2 years ago

1.2.32

2 years ago

1.2.33

2 years ago

1.2.38

2 years ago

1.2.39

2 years ago

1.2.36

2 years ago

1.2.37

2 years ago

1.2.23

3 years ago

1.2.24

3 years ago

1.2.27

3 years ago

1.2.25

3 years ago

1.2.26

3 years ago

1.2.22

3 years ago

1.2.18

3 years ago

1.2.19

3 years ago

1.2.20

3 years ago

1.2.21

3 years ago

1.2.12

3 years ago

1.2.13

3 years ago

1.2.16

3 years ago

1.2.17

3 years ago

1.2.14

3 years ago

1.2.15

3 years ago

1.2.10

3 years ago

1.2.11

3 years ago

1.2.9

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago