mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
build: add build tags to create customizable binaries
This commit is contained in:
+3
-27
@@ -8,10 +8,9 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/anuvu/zot/errors"
|
||||
cveinfo "github.com/anuvu/zot/pkg/extensions/search/cve"
|
||||
ext "github.com/anuvu/zot/pkg/extensions"
|
||||
"github.com/anuvu/zot/pkg/log"
|
||||
"github.com/anuvu/zot/pkg/storage"
|
||||
"github.com/gorilla/handlers"
|
||||
@@ -52,31 +51,8 @@ func (c *Controller) Run() error {
|
||||
}
|
||||
|
||||
// Updating the CVE Database
|
||||
if c.Config != nil && c.Config.Extensions != nil && c.Config.Extensions.Search != nil &&
|
||||
c.Config.Extensions.Search.CVE != nil {
|
||||
defaultUpdateInterval, _ := time.ParseDuration("2h")
|
||||
|
||||
if c.Config.Extensions.Search.CVE.UpdateInterval < defaultUpdateInterval {
|
||||
c.Config.Extensions.Search.CVE.UpdateInterval = defaultUpdateInterval
|
||||
c.Log.Warn().Msg("CVE update interval set to too-short interval <= 1, changing update duration to 2 hours and continuing.") // nolint: lll
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
c.Log.Info().Msg("Updating the CVE database")
|
||||
|
||||
err := cveinfo.UpdateCVEDb(c.Config.Storage.RootDirectory, c.Log)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.Log.Info().Str("Db update completed, next update scheduled after", c.Config.Extensions.Search.CVE.UpdateInterval.String()).Msg("") //nolint: lll
|
||||
|
||||
time.Sleep(c.Config.Extensions.Search.CVE.UpdateInterval)
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
c.Log.Info().Msg("Cve config not provided, skipping cve update")
|
||||
if c.Config != nil {
|
||||
ext.EnableExtension(c.Config.Extensions, c.Log, c.Config.Storage.RootDirectory)
|
||||
}
|
||||
|
||||
c.Router = engine
|
||||
|
||||
Reference in New Issue
Block a user