Added search extension and integrated trivy to support image vulnerability scanning

This commit is contained in:
Shivam Mishra
2020-06-24 12:38:42 -07:00
parent a06ad7e701
commit e537f27f00
7 changed files with 832 additions and 81 deletions
+29 -10
View File
@@ -1,6 +1,8 @@
package api
import (
"time"
"github.com/anuvu/zot/errors"
"github.com/anuvu/zot/pkg/log"
"github.com/getlantern/deepcopy"
@@ -10,6 +12,8 @@ import (
// Commit ...
var Commit string //nolint: gochecknoglobals
const updateInterval = 24
type StorageConfig struct {
RootDirectory string
GC bool
@@ -68,21 +72,36 @@ type LogConfig struct {
Output string
}
type ExtensionConfig struct {
Search *SearchConfig
}
type SearchConfig struct {
// CVE search
CVE *CVEConfig
}
type CVEConfig struct {
UpdateInterval time.Duration // should be 2 hours or more, if not specified default be kept as 24 hours
}
type Config struct {
Version string
Commit string
Storage StorageConfig
HTTP HTTPConfig
Log *LogConfig
Version string
Commit string
Storage StorageConfig
HTTP HTTPConfig
Log *LogConfig
Extensions *ExtensionConfig
}
func NewConfig() *Config {
return &Config{
Version: dspec.Version,
Commit: Commit,
Storage: StorageConfig{GC: true, Dedupe: true},
HTTP: HTTPConfig{Address: "127.0.0.1", Port: "8080"},
Log: &LogConfig{Level: "debug"},
Version: dspec.Version,
Commit: Commit,
Storage: StorageConfig{GC: true, Dedupe: true},
HTTP: HTTPConfig{Address: "127.0.0.1", Port: "8080"},
Log: &LogConfig{Level: "debug"},
Extensions: &ExtensionConfig{&SearchConfig{CVE: &CVEConfig{UpdateInterval: updateInterval}}},
}
}