Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spider-gazelle/secrets-env
Extension to the crystal lang ENV module to support reading secrets
https://github.com/spider-gazelle/secrets-env
Last synced: 3 months ago
JSON representation
Extension to the crystal lang ENV module to support reading secrets
- Host: GitHub
- URL: https://github.com/spider-gazelle/secrets-env
- Owner: spider-gazelle
- License: mit
- Created: 2020-05-18T13:20:36.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-22T23:31:22.000Z (over 3 years ago)
- Last Synced: 2024-06-21T18:11:02.842Z (5 months ago)
- Language: Crystal
- Homepage:
- Size: 23.4 KB
- Stars: 6
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - secrets-env - Extends ENV module to read values injected by docker / kubernetes secrets and other orchestration tools (Serverless Computing)
README
# secrets-env
Extends the behaviour of the crystal-lang `ENV` module to read values injected by [docker secrets](https://docs.docker.com/engine/swarm/secrets/), [kubernetes secrets](https://kubernetes.io/docs/concepts/configuration/secret/) and other orchestration tools.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
secrets-env:
github: spider-gazelle/secrets-env
```2. Run `shards install`
## Usage
```crystal
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.