-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (27 loc) · 1.11 KB
/
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
package main
import (
"flag"
"os"
"github.com/S-Bohn/cert-manager-webhook-hetzner/internal/webhook"
"github.com/cert-manager/cert-manager/pkg/acme/webhook/cmd"
)
var (
groupName string = os.Getenv("GROUP_NAME")
apiBaseURL string = os.Getenv("DNS_API_URL")
defaultAPIKeyKey string = os.Getenv("DNS_API_DEFAULT_SECRET_KEY")
defaultAPIKeyName string = os.Getenv("DNS_API_DEFAULT_SECRET_NAME")
)
func main() {
flag.StringVar(&groupName, "group-name", groupName, "define the group name")
flag.StringVar(&apiBaseURL, "api-base-url", apiBaseURL, "override hetzner dns api base url")
flag.StringVar(&defaultAPIKeyName, "api-key-secret-name", defaultAPIKeyName, "allows setting a default secret for the hetzner dns api key")
flag.StringVar(&defaultAPIKeyKey, "api-key-secret-key", defaultAPIKeyKey, "allows setting a default secret key for the hetzner dns api key")
if groupName == "" {
panic("GROUP_NAME must be specified")
}
if apiBaseURL == "" {
apiBaseURL = "https://dns.hetzner.com/api"
}
w := webhook.New(defaultAPIKeyName, defaultAPIKeyKey, apiBaseURL)
cmd.RunWebhookServer(groupName, &w)
}