github.com/datatogether/config
config is hassle-free config struct setting. setting things like configStruct.StringField to the value of the enviornment variable STRING_FIELD. It wraps the lovely godotenv package, which itself is a go port of the ruby dotenv gem. Basic use has three steps: config will read that env file, setting environment variables for the running process and infer any ENVIRIONMENT_VARIABLE value to it's cfg.EnvironmentVariable counterpart/ config uses a CamelCase -> CAMEL_CASE convention to map values. So a struct field cfg.FieldName will map to an environment variable FIELD_NAME. Types are inferred, with errors returned for invalid env var settings. using an env file is optional, calling Load(cfg) is perfectly valid. config uses the reflect package to infer & set values reflect is a good choice here because setting config happens seldom in the course of a running program, and these days if you're parsing JSON, the reflect package is already included in your binary
proxy.golang.org
v0.0.0-20171026195136-ce668ee661fa
over 8 years ago
1
2
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/github.com/datatogether/config
spec |
| License | AGPL-3.0 |
| Namespace | github.com/datatogether |
| First Release | over 8 years ago |
| Last Synced | 27 days ago |
Repository
| Stars | 1 on GitHub |
| Forks | 0 on GitHub |