fibercrypto / fibercrypto/skycoin
Load settings from disk
- Dominant language
- Go
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
* Load settings from a file on disk (filetype toml).
* Look for the config file in the application directory (default `$HOME/.skycoin`) first, then look in the current directory `.`.
* Defaults should be set in the application and also included in an example config.toml file in the repo root.
* Command line API should support the same options as it does now.
* Any setting on the command line should override config file settings.
Two special command line options are needed:
* `--app-dir` - this is special because it changes where the config file is looked for
* `--config` - this is special because it specifies the config file exactly
These two flags must be parsed first to be able to load the config file, then the remaining flags can override settings in the config file.
Use these libraries:
https://github.com/spf13/viper
https://github.com/spf13/pflag
See teller for some more examples of usage:
https://github.com/skycoin/teller/blob/f5ff644d0f765540310e9bb46389ef9751044a35/cmd/teller/teller.go#L41-L60
https://github.com/skycoin/teller/blob/develop/src/config/config.go
https://github.com/skycoin/teller/blob/develop/config.toml
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.