aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cmd.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/cmd.go b/cmd/cmd.go
index 80c1527..1619a71 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -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