pub struct Config {
pub ghsa_token: Option<String>,
pub nvd_api_key: Option<String>,
pub redis_url: String,
pub ossindex: Option<OssIndexConfig>,
pub nvd: NvdConfig,
pub store: StoreConfig,
}Expand description
Main configuration for VulnerabilityManager.
Fields§
§ghsa_token: Option<String>GitHub Personal Access Token for GHSA API.
nvd_api_key: Option<String>NVD API key (optional, but recommended for higher rate limits).
redis_url: StringRedis/DragonflyDB connection URL.
ossindex: Option<OssIndexConfig>OSS Index configuration (optional).
nvd: NvdConfigNVD source configuration.
store: StoreConfigStore configuration.
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Load configuration from environment variables.
§Environment Variables
VULNERA__APIS__GHSA__TOKEN- GitHub token for GHSA (required for GHSA source)VULNERA__APIS__NVD__API_KEY- NVD API key (optional)REDIS_URL- Redis connection URL (default:redis://127.0.0.1:6379)OSSINDEX_USER- OSS Index username (optional)OSSINDEX_TOKEN- OSS Index token (optional)VULNERA__STORE__TTL_SECONDS- Advisory TTL in seconds (optional)
§Errors
Returns AdvisoryError::Config if required variables are missing.
Sourcepub fn for_testing(redis_url: &str) -> Self
pub fn for_testing(redis_url: &str) -> Self
Create a minimal configuration for testing.
Sourcepub fn validate_for_ghsa(&self) -> Result<&str>
pub fn validate_for_ghsa(&self) -> Result<&str>
Validate that required configuration is present for specific sources.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more