Added config enable=true/false for extensions with default value as enabled closes #258

Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
Alexei Dodon
2021-12-28 15:29:30 +02:00
committed by Ramkumar Chinchani
parent 730fe70f2f
commit 47c9b6244e
19 changed files with 970 additions and 85 deletions
+6 -4
View File
@@ -290,7 +290,6 @@ func TestServerCVEResponse(t *testing.T) {
url := test.GetBaseURL(port)
conf := config.New()
conf.HTTP.Port = port
ctlr := api.NewController(conf)
dir, err := ioutil.TempDir("", "oci-repo-test")
if err != nil {
@@ -304,18 +303,21 @@ func TestServerCVEResponse(t *testing.T) {
defer os.RemoveAll(dir)
ctlr.Config.Storage.RootDirectory = dir
conf.Storage.RootDirectory = dir
cveConfig := &extconf.CVEConfig{
UpdateInterval: 2,
}
defaultVal := true
searchConfig := &extconf.SearchConfig{
CVE: cveConfig,
Enable: true,
Enable: &defaultVal,
}
ctlr.Config.Extensions = &extconf.ExtensionConfig{
conf.Extensions = &extconf.ExtensionConfig{
Search: searchConfig,
}
ctlr := api.NewController(conf)
go func(controller *api.Controller) {
// this blocks
if err := controller.Run(); err != nil {