-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (39 loc) · 994 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"flag"
"fmt"
"log"
"github.com/cloudflare/cloudflare-go"
"git.leon.wtf/leon/new-cfupdater/config"
)
var (
confPath *string = flag.String("config", "./config.json", "Path to the config.json file")
verbose *bool = flag.Bool("verbose", false, "Whether to print verbose output to stdout")
cfAPI *cloudflare.API
conf *config.Config
)
func main() {
fmt.Println()
fmt.Println(" ~ New CFUpdater by leon.wtf ~ ")
fmt.Println()
flag.Parse()
log.Println("Loading config from", *confPath)
confTemp, err := config.Load(*confPath)
if err != nil {
panic(err)
}
if err := confTemp.Validate(); err != nil {
panic(err)
}
conf = confTemp // assign to global conf
log.Println("Logging in to Clouflare API")
cfAPI, err = cloudflare.NewWithAPIToken(conf.APIToken)
if err != nil {
panic(err)
}
log.Println("Retrieving all zone IDs")
if err := GetAllZoneIDs(); err != nil {
panic(err)
}
StartSchedules(conf.CheckInterval) // blocking
}