diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-03-18 22:58:59 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-03-18 22:58:59 -0400 |
commit | ebefd7edaa5d6221a785c89bd5c303005ae42043 (patch) | |
tree | 88bcf9438d814f2939a29e9a76902ebc5ae93b63 | |
parent | 716a7adf7432925ca67fc354acec86ad36db87a5 (diff) | |
download | cvez-ebefd7edaa5d6221a785c89bd5c303005ae42043.tar.bz2 cvez-ebefd7edaa5d6221a785c89bd5c303005ae42043.zip |
cmd/update.go: use getCache()
-rw-r--r-- | cmd/update.go | 14 |
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) }, } |