ReadConfig reads in the configuration values from the diskplayer.yaml configuration file.
(n string)
| 8 | |
| 9 | // ReadConfig reads in the configuration values from the diskplayer.yaml configuration file. |
| 10 | func ReadConfig(n string) { |
| 11 | viper.SetConfigName(n) |
| 12 | viper.AddConfigPath("/etc/diskplayer/") |
| 13 | viper.AddConfigPath("$HOME/.config/diskplayer/") |
| 14 | viper.AddConfigPath(".") |
| 15 | viper.SetDefault("token.path", "token.json") |
| 16 | viper.SetDefault("spotify.callback_url", "http://localhost:8080/callback") |
| 17 | viper.SetDefault("recorder.server_port", "3000") |
| 18 | err := viper.ReadInConfig() |
| 19 | if err != nil { |
| 20 | panic(fmt.Errorf("Fatal error config file: %s \n", err)) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | // ConfigValue returns the configuration value identified by the provided key. |
| 25 | // If none is found the application quits with an error message and exit code 1. |
no outgoing calls