7167: when the config file does not contain '/', use $HOME/.config/arvados/<filename>.
authorradhika <radhika@curoverse.com>
Wed, 14 Oct 2015 02:27:41 +0000 (22:27 -0400)
committerradhika <radhika@curoverse.com>
Wed, 14 Oct 2015 02:27:41 +0000 (22:27 -0400)
tools/keep-rsync/keep-rsync.go

index bdfcb276c10bb3a3a45eac5165b256885d24fad7..9f14a9e5c08cd7e5670bc21e70017ede04fcb92e 100644 (file)
@@ -11,6 +11,7 @@ import (
        "io/ioutil"
        "log"
        "net/http"
+       "os"
        "regexp"
        "strings"
        "time"
@@ -109,7 +110,12 @@ var matchTrue = regexp.MustCompile("^(?i:1|yes|true)$")
 
 // Read config from file
 func readConfigFromFile(filename string) (config arvadosclient.APIConfig, blobSigningKey string, err error) {
+       if !strings.Contains(filename, "/") {
+               filename = os.Getenv("HOME") + "/.config/arvados/" + filename
+       }
+
        content, err := ioutil.ReadFile(filename)
+
        if err != nil {
                return config, "", err
        }