Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-bench
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
aquasecurity
kube-bench
Commits
0d6d3a03
Commit
0d6d3a03
authored
7 years ago
by
Liz Rice
Browse files
Options
Downloads
Patches
Plain Diff
Allow config file to be specified on the command line
parent
96364e3f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/root.go
+4
-4
4 additions, 4 deletions
cmd/root.go
with
4 additions
and
4 deletions
cmd/root.go
+
4
−
4
View file @
0d6d3a03
...
...
@@ -71,18 +71,18 @@ func init() {
""
,
`Run all the checks under this comma-delimited list of groups. Example --group="1.1"`
,
)
RootCmd
.
PersistentFlags
()
.
StringVar
(
&
cfgFile
,
"config"
,
""
,
"config file (default is ./cfg/config.yaml)"
)
}
// initConfig reads in config file and ENV variables if set.
func
initConfig
()
{
if
cfgFile
!=
""
{
// enable ability to specify config file via flag
viper
.
SetConfigFile
(
cfgFile
)
}
else
{
viper
.
SetConfigName
(
"config"
)
// name of config file (without extension)
viper
.
AddConfigPath
(
cfgDir
)
// adding ./cfg as first search path
}
viper
.
SetConfigName
(
"config"
)
// name of config file (without extension)
viper
.
AddConfigPath
(
cfgDir
)
// adding home directory as first search path
viper
.
SetEnvPrefix
(
"CISK8S"
)
viper
.
AutomaticEnv
()
// read in environment variables that match
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment