use std::path::PathBuf;
use super::Config;
use crate::{KonarrError as Error, utils::grypedb::GrypeDatabase};
impl Config {
pub fn grype_path(&self) -> Result<PathBuf, Error> {
let path = self.data_path()?.join("grypedb");
if !path.exists() {
log::debug!("Creating Grype path");
std::fs::create_dir_all(&path)?;
}
Ok(path)
}
pub async fn grype_connection(&self) -> Result<GrypeDatabase, Error> {
GrypeDatabase::connect(&self.grype_path()?).await
}
}