Golang library for managing configuration data from environment variables
by kelseyhightowerGo
Last 12 weeks · 0 commits
2 of 6 standards met
Summary invoked (and Decode/Set) on nil pointer values. Slice elements such as and unset fields therefore panicked: Nil pointers are now allocated before those methods run, matching the existing allocation that already happened later for non-interface pointer fields. Fixes #157 Test covers a slice and a nil field whose implements . It panicked before this change.
Closes #130 Summary Adds built-in support for the Docker/Kubernetes secrets convention. When an environment variable is unset or empty, envconfig also looks for a companion variable with a suffix (e.g. ). If set, that value is treated as a filesystem path; the file contents are read and used as the configuration value after trailing newlines are trimmed. Non-empty environment variables take precedence over Missing/unreadable files return an error is satisfied when the value comes from a file treats known companions as allowed Existing / API is unchanged (always-on, no new options) This differs from #210, which only exposes a custom hook for applications to implement themselves. Built-in support matches the convention used by Postgres, Redis, and similar images and what was requested in #130. Example Test plan [x] Unit tests with temp files covering: basic read and trailing newline trim env takes precedence over empty env falls back to required field via missing file error alt () name with default when neither env nor file is set allows [x] Full suite:
Repository: kelseyhightower/envconfig. Description: Golang library for managing configuration data from environment variables Stars: 5467, Forks: 397. Primary language: Go. Languages: Go (100%). License: MIT. Latest release: v1.4.0 (7y ago). Open PRs: 35, open issues: 27. Last activity: 1y ago. Community health: 42%. Top contributors: kelseyhightower, teepark, dan9186, andrei-m, dbainbri-ciena, mark-adams, FranGM, AlekSi, aybabtme, relistan and others.