Topic
configuration周りは spf13/viper
を利用する
Summary
viperは以下をサポートしている
- setting defaults
- reading from JSON, TOML, YAML, HCL, envfile and Java - properties config files
- live watching and re-reading of config files (optional)
- reading from environment variables
- reading from remote config systems (etcd or Consul), and - watching changes
- reading from command line flags
- reading from buffer
- setting explicit values
Pro Tip: Keep Viper Isolated → Config Packageを用意する
https://carolynvanslyck.com/talk/go/cli/#/sting-of-the-viper
→ the configuration was loaded once
→ App structをリファクタ
https://carolynvanslyck.com/talk/go/cli/#/app-with-config-pkg
- App take in a config load it up
- save that struct
- work with it
How's day been?
Good 😉