Reviewed-on: #26
This commit was merged in pull request #26.
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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(),
|
||||
|
||||
10
crates/adapters/tmdb-enrichment/tests/client_tls.rs
Normal file
10
crates/adapters/tmdb-enrichment/tests/client_tls.rs
Normal 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");
|
||||
}
|
||||
Reference in New Issue
Block a user