refactor: adapters configured from config crate
This commit is contained in:
@@ -9,6 +9,7 @@ nats = ["dep:nats", "infra-wiring/nats"]
|
||||
federation = ["application/federation", "dep:sqlite-federation", "dep:activitypub"]
|
||||
|
||||
[dependencies]
|
||||
config = { workspace = true }
|
||||
domain = { workspace = true }
|
||||
application = { workspace = true }
|
||||
infra-wiring = { workspace = true }
|
||||
|
||||
@@ -103,20 +103,28 @@ pub async fn build_database_adapters(
|
||||
})
|
||||
}
|
||||
|
||||
pub fn build_auth_adapters() -> anyhow::Result<(Arc<dyn AuthService>, Arc<dyn PasswordHasher>)> {
|
||||
auth::create()
|
||||
pub fn build_auth_adapters(
|
||||
config: &config::AuthConfig,
|
||||
) -> anyhow::Result<(Arc<dyn AuthService>, Arc<dyn PasswordHasher>)> {
|
||||
auth::create(config)
|
||||
}
|
||||
|
||||
pub fn build_metadata_client() -> anyhow::Result<Arc<dyn MetadataClient>> {
|
||||
metadata::create()
|
||||
pub fn build_metadata_client(
|
||||
config: &config::MetadataConfig,
|
||||
) -> anyhow::Result<Arc<dyn MetadataClient>> {
|
||||
metadata::create(config)
|
||||
}
|
||||
|
||||
pub fn build_poster_fetcher() -> anyhow::Result<Arc<dyn PosterFetcherClient>> {
|
||||
poster_fetcher::create()
|
||||
pub fn build_poster_fetcher(
|
||||
config: &config::MetadataConfig,
|
||||
) -> anyhow::Result<Arc<dyn PosterFetcherClient>> {
|
||||
poster_fetcher::create(config)
|
||||
}
|
||||
|
||||
pub fn build_object_storage() -> anyhow::Result<Arc<dyn ObjectStorage>> {
|
||||
object_storage::create()
|
||||
pub fn build_object_storage(
|
||||
config: &config::StorageConfig,
|
||||
) -> anyhow::Result<Arc<dyn ObjectStorage>> {
|
||||
object_storage::create(config)
|
||||
}
|
||||
|
||||
pub fn build_profile_fields_repo(
|
||||
|
||||
@@ -346,6 +346,8 @@ fn test_config() -> AppConfig {
|
||||
base_url: "http://localhost:3000".into(),
|
||||
rate_limit: 20,
|
||||
refresh_ttl_seconds: 2_592_000,
|
||||
secure_cookies: false,
|
||||
cors_origins: String::new(),
|
||||
wrapup: infra_wiring::WrapUpConfig {
|
||||
font_path: None,
|
||||
logo_path: None,
|
||||
|
||||
Reference in New Issue
Block a user