|
|
@ -9,10 +9,12 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
viper.SetConfigName("config") // name of config file (without extension)
|
|
|
|
viper.SetConfigName("config") // name of config file (without extension)
|
|
|
|
viper.SetConfigType("yaml") // REQUIRED if the config file does not have the extension in the name
|
|
|
|
viper.SetConfigType("yaml") // REQUIRED if the config file does not have the extension in the name
|
|
|
|
viper.AddConfigPath(".") // optionally look for config in the working directory
|
|
|
|
viper.AddConfigPath("/etc/appname/") // path to look for the config file in
|
|
|
|
viper.ReadInConfig() // Find and read the config file
|
|
|
|
viper.AddConfigPath("$HOME/.appname") // call multiple times to add many search paths
|
|
|
|
|
|
|
|
viper.AddConfigPath(".") // optionally look for config in the working directory
|
|
|
|
|
|
|
|
viper.ReadInConfig() // Find and read the config file
|
|
|
|
|
|
|
|
|
|
|
|
viper.SetDefault("server.scheme", "http")
|
|
|
|
viper.SetDefault("server.scheme", "http")
|
|
|
|
viper.SetDefault("server.host", "localhost:5001")
|
|
|
|
viper.SetDefault("server.host", "localhost:5001")
|
|
|
|