Skip to content

Commit

Permalink
fix: NVD api key should not be required
Browse files Browse the repository at this point in the history
Although providing an API key for the NVD provider is highly encouraged,
it is not required and is not set in all of our environments.

Signed-off-by: Weston Steimel <[email protected]>
  • Loading branch information
westonsteimel committed Nov 13, 2023
1 parent 678e7f7 commit 051909d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/vunnel/providers/nvd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os
from dataclasses import dataclass, field
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from vunnel import provider, result, schema
from vunnel.providers.nvd.manager import Manager
Expand All @@ -20,10 +20,10 @@ class Config:
),
)
request_timeout: int = 125
api_key: str = "env:NVD_API_KEY"
api_key: Optional[str] = "env:NVD_API_KEY" # noqa: UP007

def __post_init__(self) -> None:
if self.api_key.startswith("env:"):
if self.api_key and self.api_key.startswith("env:"):
self.api_key = os.environ.get(self.api_key[4:], "")

def __str__(self) -> str:
Expand Down

0 comments on commit 051909d

Please sign in to comment.