Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ancientlore/flagcfg
The flagcfg package populates flags from a TOML config file.
https://github.com/ancientlore/flagcfg
configuration flag golang
Last synced: 13 days ago
JSON representation
The flagcfg package populates flags from a TOML config file.
- Host: GitHub
- URL: https://github.com/ancientlore/flagcfg
- Owner: ancientlore
- License: other
- Created: 2015-05-28T16:44:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-24T18:24:30.000Z (9 months ago)
- Last Synced: 2024-11-23T16:36:10.436Z (2 months ago)
- Topics: configuration, flag, golang
- Language: Go
- Size: 15.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
flagcfg
=======[![Go Reference](https://pkg.go.dev/badge/github.com/ancientlore/flagcfg.svg)](https://pkg.go.dev/github.com/ancientlore/flagcfg)
The flagcfg package populates flags from a TOML config file.
Each flag is assumed to have an optional top-level value
in the config file, having the same name. However, if a
flag contains a dash or a period, those are converted to
underscores.Flags that have aready been assigned are not overwritten.
This package can be used together with github.com/facebookgo/flagenv
to load flags from a config file, environment variable, or command-line.Example:
// Parse flags from command-line
flag.Parse()// Parser flags from config
flagcfg.AddDefaults()
// or use flagcfg.AddDefaultFiles("MYAPP_CONFIG", "myapp.config")
flagcfg.Parse()// Parse flags from environment (using github.com/facebookgo/flagenv)
flagenv.Prefix = "MYPREFIX_"
flagenv.Parse()