Commit 7554f9f4 authored by Erick Hitter's avatar Erick Hitter
Browse files

Move config to a flag

parent 918776dc
package main
import (
"flag"
"fmt"
"github.com/joshbetz/config"
"io/ioutil"
......@@ -27,7 +28,17 @@ func init() {
logger.Println("PINGING dyndnsd ENDPOINT")
// Configuration
cfg = config.New("config.json")
var configPath string
flag.StringVar(&configPath, "config", "", "Config file path")
flag.Parse()
if _, err := os.Stat(configPath); os.IsNotExist(err) {
fmt.Println("Config path does not exist. Aborting!\n")
flag.Usage()
os.Exit(3)
}
cfg = config.New(configPath)
cfg.Get("ipv4_endpoint", &ipv4Endpoint)
cfg.Get("ipv6_endpoint", &ipv6Endpoint)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment