code refactor
Some checks failed
CI / Check / Test (push) Has been cancelled

Reviewed-on: #26
This commit was merged in pull request #26.
This commit is contained in:
2026-10-26 09:36:23 +00:00
parent 2ce7db12c2
commit 017b58d6fa
804 changed files with 33423 additions and 28955 deletions

View File

@@ -1,14 +1,13 @@
[package]
name = "tmdb-enrichment"
version = "0.1.0"
edition = "2024"
edition.workspace = true
[dependencies]
config = { workspace = true }
domain = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
anyhow = { workspace = true }
rustls = { workspace = true, features = ["ring", "std"] }
serde = { workspace = true, features = ["derive"] }
async-trait = { workspace = true }
tracing = { workspace = true }
chrono = { workspace = true }

View File

@@ -7,9 +7,12 @@ pub struct TmdbEnrichmentClient {
}
impl TmdbEnrichmentClient {
pub fn from_env() -> Result<Self, DomainError> {
let api_key = std::env::var("TMDB_API_KEY")
.map_err(|_| DomainError::InfrastructureError("TMDB_API_KEY is not set".into()))?;
pub fn from_config(config: &config::MetadataConfig) -> Result<Self, DomainError> {
let api_key = config
.tmdb_api_key
.clone()
.ok_or_else(|| DomainError::InfrastructureError("TMDB_API_KEY is not set".into()))?;
let _ = rustls::crypto::ring::default_provider().install_default();
Ok(Self {
api_key,
http: reqwest::Client::new(),

View File

@@ -0,0 +1,10 @@
use tmdb_enrichment::TmdbEnrichmentClient;
#[test]
fn tmdb_enrichment_builds_without_bootstrap() {
let cfg = config::MetadataConfig {
tmdb_api_key: Some("key".into()),
..Default::default()
};
TmdbEnrichmentClient::from_config(&cfg).expect("client builds");
}