Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: NVD api key should not be required #397

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading