2015-04-30 00:18:08 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-05-03 14:15:59 -04:00
|
|
|
"flag"
|
2015-04-30 00:18:08 -04:00
|
|
|
"fmt"
|
|
|
|
"github.com/mfycheng/name-dyndns/api"
|
2015-05-03 14:15:59 -04:00
|
|
|
"github.com/mfycheng/name-dyndns/dyndns"
|
2015-04-30 00:18:08 -04:00
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2015-05-03 14:15:59 -04:00
|
|
|
configPath := flag.String("config", "./config.json", "Specify the configuration file")
|
|
|
|
daemon := flag.Bool("daemon", false, "operate in daemon mode")
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
configs, err := api.LoadConfigs(*configPath)
|
2015-04-30 00:18:08 -04:00
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error loading config:", err)
|
|
|
|
os.Exit(1)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf("Successfully loaded %d configs\n", len(configs))
|
2015-05-03 14:15:59 -04:00
|
|
|
dyndns.Run(configs, *daemon)
|
2015-04-30 00:18:08 -04:00
|
|
|
}
|