While "doing stuff" I have found myself on new machines without my standard config. Luckily I put my (encrypted) config file on an easy to remember (to me) web server and I can make a local copy but that in turn means I leave my config file, possibly out of date, on random systems.
Would it be feasible to just pull the config from a remote web server when the --config option starts with a method instead of a file name?
I already use really primitive code in my own text processing scripts what just does this:
var f io.ReadCloser
if strings.HasPrefix(file, "http") {
fmt.Printf("fetching file %q\n", file)
res, err := http.Get(file)
if err != nil {
log.Fatal(err)
}
f = res.Body
if contents.Source == "" {
contents.Source = file
}
} else {
var err error
fmt.Printf("reading file %q\n", file)
f, err = os.Open(file)
if err != nil {
log.Fatal(err)
}
}
var content, _ = ioutil.ReadAll(f)
f.Close()
Obviously in production/public code it would have to be a little more robust, but ...?
(The encryption password would still be applied using existing means)