Read /etc/shizaru.conf if it exists and no other configuration file path is provided.

This commit is contained in:
Solderpunk 2019-06-05 12:22:31 -04:00
parent b8276dd23f
commit d80b6676dd
1 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,12 @@ func main() {
// Parse args and read config
flag.StringVar(&conf_file, "c", "", "Path to config file")
flag.Parse()
if conf_file == "" {
_, err := os.Stat("/etc/shizaru.conf")
if !os.IsNotExist(err) {
conf_file = "/etc/shizaru.conf"
}
}
config, err := getConfig(conf_file)
if err != nil {
fmt.Println("Error reading config file " + conf_file)