Skip to content

Extension to the crystal lang ENV module to support reading secrets

License

Notifications You must be signed in to change notification settings

spider-gazelle/secrets-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

secrets-env

Extends the behaviour of the crystal-lang ENV module to read values injected by docker secrets, kubernetes secrets and other orchestration tools.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      secrets-env:
        github: spider-gazelle/secrets-env
  2. Run shards install

Usage

require "secrets-env"

Use the SECRETS_PATH environment variable to specify the volume used for secrets injection. If unspecified this will default to /run/secrets.

ENV may then be used as per the standard API. Values fetch from (in order of priority):

  1. environment variable
  2. secret of the same name
  3. fallback (if specified)

Note: attempts to update the environment ([]=) will apply this as an env var. Secrets are immutable. Once set as env vars take preference over secrets, the new value is readable by the current machine, but is ephemeral.

Additionally, ENV.accessed provides a record of all accesses to the ENV variable across the program.

About

Extension to the crystal lang ENV module to support reading secrets

Resources

License

Stars

Watchers

Forks

Packages

No packages published