Read /etc/shizaru.conf if it exists and no other configuration file path is provided.
This commit is contained in:
parent
b8276dd23f
commit
d80b6676dd
6
main.go
6
main.go
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue