aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-01-25 21:40:40 +0000
committerGravatar GitHub <noreply@github.com> 2018-01-25 21:40:40 +0000
commitaeacbf6e24cae5c6bad9847628204bd39b6a0ad8 (patch)
treebbc1bb9900412b4fdfef6f8b3470277b4ca6ca2b
parentea95a2003a710b9057d7500bdca38f6394896294 (diff)
downloadcoredns-aeacbf6e24cae5c6bad9847628204bd39b6a0ad8.tar.gz
coredns-aeacbf6e24cae5c6bad9847628204bd39b6a0ad8.tar.zst
coredns-aeacbf6e24cae5c6bad9847628204bd39b6a0ad8.zip
move flag blacklisting to main (#1431)
* move flag blacklisting to main Doing it in init() is the wrong place or something else changed. Doing it in main() makes it easy to see *when* this happens. * keep trapsignals
-rw-r--r--coremain/run.go27
1 files changed, 13 insertions, 14 deletions
diff --git a/coremain/run.go b/coremain/run.go
index 61d2e24be..23d5d5f7e 100644
--- a/coremain/run.go
+++ b/coremain/run.go
@@ -18,20 +18,6 @@ import (
)
func init() {
- // Reset flag.CommandLine to get rid of unwanted flags for instance from glog (used in kubernetes).
- // And readd the once we want to keep.
- flag.VisitAll(func(f *flag.Flag) {
- if _, ok := flagsBlacklist[f.Name]; ok {
- return
- }
- flagsToKeep = append(flagsToKeep, f)
- })
-
- flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
- for _, f := range flagsToKeep {
- flag.Var(f.Value, f.Name, f.Usage)
- }
-
caddy.TrapSignals()
caddy.DefaultConfigFile = "Corefile"
caddy.Quiet = true // don't show init stuff from caddy
@@ -54,6 +40,19 @@ func init() {
// Run is CoreDNS's main() function.
func Run() {
+ // Reset flag.CommandLine to get rid of unwanted flags for instance from glog (used in kubernetes).
+ // And readd the once we want to keep.
+ flag.VisitAll(func(f *flag.Flag) {
+ if _, ok := flagsBlacklist[f.Name]; ok {
+ return
+ }
+ flagsToKeep = append(flagsToKeep, f)
+ })
+
+ flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
+ for _, f := range flagsToKeep {
+ flag.Var(f.Value, f.Name, f.Usage)
+ }
flag.Parse()