Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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 main

import (
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)
})
}
```