summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolderpunk <solderpunk@sdf.org>2019-06-05 12:22:31 -0400
committerSolderpunk <solderpunk@sdf.org>2019-06-05 12:22:31 -0400
commitd80b6676ddc66ffab1f7fbedc1937e14e3adf0e7 (patch)
treed2b54ff3c6422f2ba577a98872904888500934d0
parentb8276dd23fb6c6db50b607d8bb0421787e9da38f (diff)
Read /etc/shizaru.conf if it exists and no other configuration file path is provided.
-rw-r--r--main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.go b/main.go
index d45d2c6..7be9ce3 100644
--- a/main.go
+++ b/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)