diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-03-18 22:57:25 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-03-18 22:57:25 -0400 |
commit | 8dc327ad1970b049589f33b0eb49a2a8510c7aab (patch) | |
tree | 7d3e37a0567008f9dc9d741efd808fbf5932a663 /cmd | |
parent | f857551bc4405abe5d41e44d63cc77270ef92ab5 (diff) | |
download | cvez-8dc327ad1970b049589f33b0eb49a2a8510c7aab.tar.bz2 cvez-8dc327ad1970b049589f33b0eb49a2a8510c7aab.zip |
cmd/cmd.go: getCache(): return cache directory too
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/cmd.go | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -44,24 +44,27 @@ func getDb() dbstore.DbStore { return db } -// Get cache. -func getCache() nvdmirror.JsonCache { +// Get cache and cache directory path. +func getCache() (nvdmirror.JsonCache, string) { // get path to cache directory - cacheDir, err := datadir.CacheDir() + dir, err := datadir.CacheDir() if err != nil { log.Error().Err(err).Msg("CacheDir") os.Exit(-1) } + // build cache file path + cachePath := filepath.Join(dir, "cache.json.gz") + // create cache - cache, err := nvdmirror.NewJsonCache(filepath.Join(cacheDir, "cache.json.gz")) + cache, err := nvdmirror.NewJsonCache(cachePath) if err != nil { log.Error().Err(err).Msg("NewJsonCache") os.Exit(-1) } // return cache - return cache + return cache, dir } // JSON encode data and write it to standard output |