-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (35 loc) · 1.01 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
35
36
37
38
39
40
41
42
43
package main
import (
"github.com/camaoag/cert-manager-webhook-project-pinto/pkg/dns"
"github.com/jetstack/cert-manager/pkg/acme/webhook/cmd"
log "github.com/sirupsen/logrus"
"os"
)
// GroupName is the name under which the webhook will be available
var GroupName = os.Getenv("GROUP_NAME")
// allowed values are panic, fatal, error, warn, info, debug, trace
var logLevelEnv = os.Getenv("LOG_LEVEL")
func main() {
// setup logging
// Output to stdout instead of the default stderr
log.SetOutput(os.Stdout)
logLevel, logLevelErr := log.ParseLevel(logLevelEnv)
if logLevelErr != nil {
log.SetLevel(log.InfoLevel)
} else {
log.SetLevel(logLevel)
}
log.Info("Starting cert-manager-webhook-pinto")
log.WithFields(map[string]interface{}{
"logLevel": log.GetLevel().String(),
"groupName": GroupName,
}).Debugf("application configuration used")
if GroupName == "" {
log.Panic("GROUP_NAME must be specified")
}
cmd.RunWebhookServer(GroupName,
&dns.ProviderSolver{},
)
log.Info("Shutting down!")
log.Exit(0)
}