From 5bc692287534ccf43b7376bf66ebbddbf24ae52a Mon Sep 17 00:00:00 2001 From: Esa Jokinen <58781154+oh2fih@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:11:42 +0200 Subject: [PATCH] Improve NIST NVD API key import (#262) * Better warning message for a missing NIST API key * Fix default configuration file paths --- CveXplore/core/nvd_nist/nvd_nist_api.py | 3 ++- CveXplore/main.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CveXplore/core/nvd_nist/nvd_nist_api.py b/CveXplore/core/nvd_nist/nvd_nist_api.py index 23568656..c2a3e72e 100644 --- a/CveXplore/core/nvd_nist/nvd_nist_api.py +++ b/CveXplore/core/nvd_nist/nvd_nist_api.py @@ -55,7 +55,8 @@ def __init__( self.api_key_limit = False else: self.logger.warning( - "Could not find a NIST API Key in the '~/.cvexplore/.env' file; " + "Could not find a NIST API Key in the environment variable 'NVD_NIST_API_KEY' " + "(e.g. from the '~/.cvexplore/.env' file); " "you could request one at: https://nvd.nist.gov/developers/request-an-api-key" ) self.api_key_limit = True diff --git a/CveXplore/main.py b/CveXplore/main.py index 966826ad..d07e288b 100644 --- a/CveXplore/main.py +++ b/CveXplore/main.py @@ -14,7 +14,7 @@ if not os.path.exists(os.path.join(user_wd, ".env")): shutil.copyfile( - os.path.join(os.path.dirname(__file__), ".env_example"), + os.path.join(os.path.dirname(__file__), "common/.env_example"), os.path.join(user_wd, ".env"), ) @@ -22,7 +22,7 @@ if not os.path.exists(os.path.join(user_wd, ".sources.ini")): shutil.copyfile( - os.path.join(os.path.dirname(__file__), ".sources.ini"), + os.path.join(os.path.dirname(__file__), "common/.sources.ini"), os.path.join(user_wd, ".sources.ini"), )