refactor: collapse feature flags to federation+nats

This commit is contained in:
2026-10-25 20:37:37 +01:00
parent 933400e1c2
commit 1b7384386a
17 changed files with 54 additions and 97 deletions

View File

@@ -13,7 +13,6 @@ pub async fn create(
EventBusBackend::Db => {
tracing::info!("event bus: DB queue");
match db_pool {
#[cfg(feature = "sqlite")]
DbPool::Sqlite(pool) => {
Ok(sqlite_event_queue::SqliteEventQueue::create_channel(pool.clone()).await?)
}

View File

@@ -13,16 +13,13 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
use domain::ports::{EventHandler, MovieEnrichmentClient, PeriodicJob, PersonEnrichmentClient};
#[cfg(not(feature = "sqlite"))]
compile_error!("The sqlite feature must be enabled. Use --features sqlite");
#[tokio::main]
async fn main() -> anyhow::Result<()> {
dotenvy::dotenv().ok();
init_tracing();
let database_url = std::env::var("DATABASE_URL").context("DATABASE_URL must be set")?;
warn_if_database_backend_set();
composition::factory::warn_if_database_backend_set();
let app_config = AppConfig::from_env();
let instance = domain::value_objects::InstanceIdentity::new(app_config.base_url.clone());
@@ -82,7 +79,6 @@ async fn main() -> anyhow::Result<()> {
// Wire federation repos early to get remote_watchlist_repo for AppContext.
#[cfg(feature = "federation")]
let fed_repos = match &db.db_pool {
#[cfg(feature = "sqlite-federation")]
composition::DbPool::Sqlite(pool) => {
sqlite_federation::wire(pool.clone(), instance.clone())
}
@@ -301,14 +297,6 @@ async fn main() -> anyhow::Result<()> {
Ok(())
}
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");
}
}
fn init_tracing() {
tracing_subscriber::registry()
.with(log_filter("worker=info,application=info,k_ap=info"))