fix(report): prioritize env vars over config.toml (#1194)

This commit is contained in:
Kota Kanbe
2021-03-10 07:39:58 +09:00
committed by GitHub
parent 54e73c2f54
commit 5d47adb5c9
5 changed files with 22 additions and 29 deletions

View File

@@ -39,8 +39,6 @@ type ReportCmd struct {
toS3 bool
toAzureBlob bool
toHTTP bool
toHTTPURL string
}
// Name return subcommand name
@@ -162,8 +160,6 @@ func (p *ReportCmd) SetFlags(f *flag.FlagSet) {
f.BoolVar(&p.gzip, "gzip", false, "gzip compression")
f.BoolVar(&c.Conf.Pipe, "pipe", false, "Use args passed via PIPE")
f.StringVar(&p.toHTTPURL, "http", "", "-to-http http://vuls-report")
f.StringVar(&c.Conf.TrivyCacheDBDir, "trivy-cachedb-dir",
utils.DefaultCacheDir(), "/path/to/dir")
}
@@ -186,9 +182,6 @@ func (p *ReportCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}
c.Conf.Azure.Enabled = p.toAzureBlob
c.Conf.HTTP.Enabled = p.toHTTP
//TODO refactor
c.Conf.HTTP.Init(p.toHTTPURL)
if c.Conf.Diff {
c.Conf.DiffPlus, c.Conf.DiffMinus = true, true
}