https://github.com/andreykaipov/env2conf
quickly convert environment variables into configuration files
https://github.com/andreykaipov/env2conf
configuration environment json toml yaml
Last synced: about 2 months ago
JSON representation
quickly convert environment variables into configuration files
- Host: GitHub
- URL: https://github.com/andreykaipov/env2conf
- Owner: andreykaipov
- License: apache-2.0
- Created: 2019-06-15T04:22:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-21T00:53:16.000Z (about 7 years ago)
- Last Synced: 2025-06-22T21:06:02.026Z (about 1 year ago)
- Topics: configuration, environment, json, toml, yaml
- Language: Go
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# env2conf
[](https://goreportcard.com/report/github.com/andreykaipov/env2conf)
[](https://circleci.com/gh/andreykaipov/env2conf)
[](https://github.com/andreykaipov/env2conf)
env2conf converts environment variables into configuration files.
## usage
Available configuration outputs are:
- JSON (default)
```console
$ env server.host=0.0.0.0 server.port=8080 env2conf -prefix server
{
"server": {
"port": 8080,
"host": "0.0.0.0"
}
}
```
- YAML
```console
$ env fruits[0]=apple fruits[1]=banana fruits[2]=orange env2conf -prefix fruits -output yaml
---
fruits:
- banana
- mango
- pineapple
```
- TOML (inline)
```console
$ env inputs.cpu[0]={} outputs.file[0].files[0]=stdout env2conf -prefix inputs,outputs -output toml
outputs = {file = [{files = ["stdout"]}]}
inputs = {cpu = [{}]}
```
## installation
Binaries are available for download from the [GitHub releases](https://github.com/andreykaipov/env2conf/releases) page.
For example:
```console
$ curl -Lo env2conf https://github.com/andreykaipov/env2conf/releases/download/v0.2.0/env2conf-0.2.0-linux-amd64
$ chmod +x env2conf
$ mv env2conf /usr/local/bin
```
Alternatively, if you have Go installed:
```console
$ go get github.com/andreykaipov/env2conf
```
## development
env2conf is written in Go and has no external dependencies. Make is the build tool:
```console
$ make
$ make test
```
## limitations
- You can't use `.`, `[`, or `]` in key names
- The top-level object can't be an array