Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
da742ed5
Commit
da742ed5
authored
Nov 09, 2016
by
Miek Gieben
Committed by
GitHub
Nov 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: remove unwanted flags (#410)
Remove unwanted flags (mostly from glog) and keep the ones we need.
parent
0f8cb509
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
coremain/run.go
coremain/run.go
+28
-0
No files found.
coremain/run.go
View file @
da742ed5
...
@@ -21,6 +21,20 @@ import (
...
@@ -21,6 +21,20 @@ import (
)
)
func
init
()
{
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
.
TrapSignals
()
caddy
.
DefaultConfigFile
=
"Corefile"
caddy
.
DefaultConfigFile
=
"Corefile"
caddy
.
Quiet
=
true
// don't show init stuff from caddy
caddy
.
Quiet
=
true
// don't show init stuff from caddy
...
@@ -40,6 +54,7 @@ func init() {
...
@@ -40,6 +54,7 @@ func init() {
// Run is CoreDNS's main() function.
// Run is CoreDNS's main() function.
func
Run
()
{
func
Run
()
{
flag
.
Parse
()
flag
.
Parse
()
caddy
.
AppName
=
coreName
caddy
.
AppName
=
coreName
...
@@ -230,3 +245,16 @@ var (
...
@@ -230,3 +245,16 @@ var (
gitShortStat
string
// git diff-index --shortstat
gitShortStat
string
// git diff-index --shortstat
gitFilesModified
string
// git diff-index --name-only HEAD
gitFilesModified
string
// git diff-index --name-only HEAD
)
)
// flagsBlacklist removes flags with these names from our flagset.
var
flagsBlacklist
=
map
[
string
]
bool
{
"logtostderr"
:
true
,
"alsologtostderr"
:
true
,
"v"
:
true
,
"stderrthreshold"
:
true
,
"vmodule"
:
true
,
"log_backtrace_at"
:
true
,
"log_dir"
:
true
,
}
var
flagsToKeep
[]
*
flag
.
Flag
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment