refactor: collapse feature flags to federation+nats
This commit is contained in:
@@ -123,9 +123,14 @@ pub fn build_profile_fields_repo(
|
||||
pool: &DbPool,
|
||||
) -> anyhow::Result<Arc<dyn UserProfileFieldsRepository>> {
|
||||
match pool {
|
||||
#[cfg(feature = "sqlite")]
|
||||
DbPool::Sqlite(pool) => Ok(sqlite::create_profile_fields_repo(pool.clone())),
|
||||
#[cfg(not(feature = "sqlite"))]
|
||||
_ => anyhow::bail!("no profile fields repo for this backend"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn warn_if_database_backend_set() {
|
||||
if let Ok(v) = std::env::var("DATABASE_BACKEND")
|
||||
&& v != "sqlite"
|
||||
{
|
||||
tracing::warn!("DATABASE_BACKEND is ignored; SQLite is the only backend");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,11 +265,7 @@ fn test_repositories() -> Repositories {
|
||||
}
|
||||
|
||||
/// A lazily-connected in-memory sqlite pool — never actually opened in this test,
|
||||
/// just a value to satisfy `DatabaseOutput::db_pool`. Requires the `sqlite` feature,
|
||||
/// which `cargo test --workspace` enables transitively (presentation/worker both
|
||||
/// default to it), matching how `DbPool::Sqlite` is only constructible under that
|
||||
/// feature everywhere else in the workspace.
|
||||
#[cfg(feature = "sqlite")]
|
||||
/// just a value to satisfy `DatabaseOutput::db_pool`.
|
||||
fn test_db_pool() -> infra_wiring::DbPool {
|
||||
let pool = sqlx::sqlite::SqlitePoolOptions::new()
|
||||
.connect_lazy("sqlite::memory:")
|
||||
@@ -277,14 +273,6 @@ fn test_db_pool() -> infra_wiring::DbPool {
|
||||
infra_wiring::DbPool::Sqlite(pool)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "sqlite"))]
|
||||
fn test_db_pool() -> infra_wiring::DbPool {
|
||||
unreachable!(
|
||||
"worker_deps_wiring needs the sqlite feature; cargo test --workspace enables it \
|
||||
transitively via presentation/worker's default features"
|
||||
)
|
||||
}
|
||||
|
||||
fn test_database_output() -> DatabaseOutput {
|
||||
let movies = InMemoryMovieRepository::new();
|
||||
let watch_events = InMemoryWatchEventRepository::new();
|
||||
|
||||
Reference in New Issue
Block a user