Skip to content

Instantly share code, notes, and snippets.

@mrsoftware
Created December 3, 2019 11:27
Show Gist options
  • Save mrsoftware/0c65c4dd04f8352b55febc5178924370 to your computer and use it in GitHub Desktop.
Save mrsoftware/0c65c4dd04f8352b55febc5178924370 to your computer and use it in GitHub Desktop.
func init() {
viper.SetConfigFile(`config.json`)
err := viper.ReadInConfig()
if err != nil {
panic(err)
}
if viper.GetBool(`debug`) {
fmt.Println("Service RUN on DEBUG mode")
}
}
// and use it
// dbHost := viper.GetString(`database.host`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment