MCPcopy Index your code
hub / github.com/dinofizz/diskplayer / ReadConfig

Function ReadConfig

config.go:10–22  ·  view source on GitHub ↗

ReadConfig reads in the configuration values from the diskplayer.yaml configuration file.

(n string)

Source from the content-addressed store, hash-verified

8
9// ReadConfig reads in the configuration values from the diskplayer.yaml configuration file.
10func 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.

Callers 4

mainFunction · 0.92
mainFunction · 0.92
TestReadConfigErrorFunction · 0.85
TestConfigValueFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestReadConfigErrorFunction · 0.68
TestConfigValueFunction · 0.68