secrets-env

Extension to the crystal lang ENV module to support reading secrets
1.0.0 Latest release released

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: place-labs/secret-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.

Contributing

  1. Fork it (https://github.com/place-labs/secret-env/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

secrets-env:
  github: place-labs/secrets-env
  version: ~> 1.0.0
License MIT
Crystal 0.34.0

Authors

Dependencies 0

Development Dependencies 0

Dependents 1

Last synced .
search fire star recently