blob: f1f9250828fdc318821f45cd3562a4de64d31bea [file] [log] [blame]
gioe72b54f2024-04-22 10:44:41 +04001package main
2
3import (
4 "flag"
gio381c7672026-07-23 15:28:26 +04005 "fmt"
gioe72b54f2024-04-22 10:44:41 +04006 "strings"
7)
8
9var port = flag.Int("port", 8080, "Port to listen on")
10var rootDir = flag.String("root-dir", "", "Path to generate DNS sec keys")
11var config = flag.String("config", "", "Coredns config file name")
12var db = flag.String("db", "", "DNS records db file name")
13var zone = flag.String("zone", "", "Zone domain")
14var publicIPs = flag.String("public-ip", "", "Comma separated list of public IPs of the pcloud environment")
15var privateIP = flag.String("private-ip", "", "Private IP of the pcloud environment")
16var nameserverIPs = flag.String("nameserver-ip", "", "Comma separated list of nameserver IPs")
17
18func main() {
19 flag.Parse()
20 publicIP := strings.Split(*publicIPs, ",")
21 nameserverIP := strings.Split(*nameserverIPs, ",")
22 fs := osFS{*rootDir}
23 store, ds, err := NewStore(fs, *config, *db, *zone, publicIP, *privateIP, nameserverIP)
24 if err != nil {
25 panic(err)
26 }
gio381c7672026-07-23 15:28:26 +040027 if all, err := store.All(); err != nil {
giof6ad2982024-08-23 17:42:49 +040028 panic(err)
gio381c7672026-07-23 15:28:26 +040029 } else {
30 fmt.Println(all)
giof6ad2982024-08-23 17:42:49 +040031 }
gioe72b54f2024-04-22 10:44:41 +040032 server := NewServer(*port, *zone, ds, store, nameserverIP)
33 server.Start()
34}