Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thetardigrade/golang-envstore
Go package to read, parse and store environment files, strings and variables.
https://github.com/thetardigrade/golang-envstore
configuration-files configuration-management env-file environment environment-variables go golang
Last synced: 10 days ago
JSON representation
Go package to read, parse and store environment files, strings and variables.
- Host: GitHub
- URL: https://github.com/thetardigrade/golang-envstore
- Owner: theTardigrade
- Created: 2017-02-01T18:00:15.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2023-02-02T10:01:02.000Z (almost 2 years ago)
- Last Synced: 2024-11-08T11:13:34.710Z (2 months ago)
- Topics: configuration-files, configuration-management, env-file, environment, environment-variables, go, golang
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# golang-envStore
Store your environment variables from multiple sources (files, strings, JSON and the operating system) in one data structure, allowing easy access (potentially concurrent) from within your program.
## Example
```golang
package mainimport (
envStore "github.com/theTardigrade/golang-envStore"
)func main() {
env, err := envStore.New(&envStore.Config{
FromFilePaths: []string{"data1.env", "data2.env"},
FromStrings: []string{"x=128\ny=test\nz=/bin/bash"},
FromJSONSlices: [][]byte{[]byte(`{"key":"value","key2":"value2"}`)},
FromSystem: true,
UseMutex: true,
IgnoreEmptyLines: true,
})
if err != nil {
panic(err)
}env.Iterate(func(key, value string) {
fmt.Printf("%v :: %v\n", key, value)
})
}
```