19 lines
560 B
Go
19 lines
560 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func readConfig() {
|
|
viper.SetConfigName("openpdu") // name of config file (without extension)
|
|
viper.SetConfigType("yaml")
|
|
viper.AddConfigPath(".") // optionally look for config in the working directory
|
|
viper.AddConfigPath("/etc/openpdu/") // path to look for the config file in
|
|
err := viper.ReadInConfig() // Find and read the config file
|
|
if err != nil { // Handle errors reading the config file
|
|
log.Printf("Can't read config file: %s \n", err)
|
|
}
|
|
}
|