aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/update.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/cmd/update.go b/cmd/update.go
index e825c66..f8b2219 100644
--- a/cmd/update.go
+++ b/cmd/update.go
@@ -4,7 +4,6 @@ import (
// "encoding/json"
"github.com/pablotron/cvez/nvdmirror"
"github.com/spf13/cobra"
- "github.com/rs/zerolog/log"
)
var updateCmd = &cobra.Command{
@@ -14,13 +13,6 @@ var updateCmd = &cobra.Command{
Long: `Update local NVD mirror.`,
Run: func(cmd *cobra.Command, args []string) {
- // create cache
- cache, err := nvdmirror.NewJsonCache("stuff/cache.json.gz")
- if err != nil {
- log.Error().Err(err).Msg("NewJsonCache")
- }
- defer cache.Close()
-
// custom sync config
config := nvdmirror.SyncConfig {
Cve11BaseUrl: "https://pmdn.org/cvez-test/20220318/nvd/cve",
@@ -30,7 +22,11 @@ var updateCmd = &cobra.Command{
CweListUrl: "https://pmdn.org/cvez-test/20220318/cwe/cwec_latest.xml.zip",
}
+ // get cache and cache dir
+ cache, cacheDir := getCache()
+ defer cache.Close()
+
// sync data, get changed data
- nvdmirror.Sync(config, &cache, "stuff")
+ nvdmirror.Sync(config, &cache, cacheDir)
},
}