mirror of
https://github.com/eliasstepanik/caddy-ingess.git
synced 2026-01-11 20:48:27 +00:00
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
|
|
"github.com/caddyserver/ingress/internal/caddy"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func parseFlags() caddy.ControllerConfig {
|
|
var email string
|
|
flag.StringVar(&email, "email", "", "the email address to use for requesting tls certificates if automatic https is enabled.")
|
|
|
|
var namespace string
|
|
flag.StringVar(&namespace, "namespace", "", "the namespace that you would like to observe kubernetes ingress resources in.")
|
|
|
|
var enableAutomaticTLS bool
|
|
flag.BoolVar(&enableAutomaticTLS, "tls", false, "defines if automatic tls should be enabled for hostnames defined in ingress resources.")
|
|
|
|
var tlsUseStaging bool
|
|
flag.BoolVar(&tlsUseStaging, "tls-use-staging", false, "defines if the lets-encrypt staging server should be used for testing the provisioning of tls certificates.")
|
|
|
|
flag.Parse()
|
|
|
|
if email == "" && enableAutomaticTLS {
|
|
logrus.Info("An email must be defined for automatic tls features, set flag `email` with the email address you would like to use for certificate registration.")
|
|
enableAutomaticTLS = false
|
|
}
|
|
|
|
return caddy.ControllerConfig{
|
|
Email: email,
|
|
AutomaticTLS: enableAutomaticTLS,
|
|
TLSUseStaging: tlsUseStaging,
|
|
WatchNamespace: namespace,
|
|
}
|
|
}
|