Skip to content

Commit

Permalink
Improve NIST NVD API key import (#262)
Browse files Browse the repository at this point in the history
* Better warning message for a missing NIST API key

* Fix default configuration file paths
  • Loading branch information
oh2fih authored Jan 29, 2024
1 parent a0f43a0 commit 5bc6922
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CveXplore/core/nvd_nist/nvd_nist_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions CveXplore/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

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"),
)

load_dotenv(os.path.join(user_wd, ".env"))

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"),
)

Expand Down

0 comments on commit 5bc6922

Please sign in to comment.