refactor: bootstrap crate, thin server/worker binaries
This commit is contained in:
@@ -1 +1,41 @@
|
||||
pub use infra_wiring::{AppConfig, WrapUpConfig};
|
||||
#[derive(Clone)]
|
||||
pub struct AppConfig {
|
||||
pub allow_registration: bool,
|
||||
pub base_url: String,
|
||||
pub rate_limit: u64,
|
||||
pub refresh_ttl_seconds: u64,
|
||||
pub secure_cookies: bool,
|
||||
pub cors_origins: String,
|
||||
pub wrapup: WrapUpConfig,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct WrapUpConfig {
|
||||
pub font_path: Option<String>,
|
||||
pub logo_path: Option<String>,
|
||||
pub bg_dir: Option<String>,
|
||||
}
|
||||
|
||||
impl From<&::config::AppConfig> for AppConfig {
|
||||
fn from(config: &::config::AppConfig) -> Self {
|
||||
Self {
|
||||
allow_registration: config.server.allow_registration,
|
||||
base_url: config.server.base_url.clone(),
|
||||
rate_limit: config.server.rate_limit,
|
||||
refresh_ttl_seconds: config.auth.refresh_ttl_seconds,
|
||||
secure_cookies: config.server.secure_cookies,
|
||||
cors_origins: config.server.cors_origins.clone(),
|
||||
wrapup: WrapUpConfig::from(&config.wrapup),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&::config::WrapUpConfig> for WrapUpConfig {
|
||||
fn from(config: &::config::WrapUpConfig) -> Self {
|
||||
Self {
|
||||
font_path: config.font_path.clone(),
|
||||
logo_path: config.logo_path.clone(),
|
||||
bg_dir: config.bg_dir.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,10 +153,10 @@ pub struct WrapupGroup {
|
||||
/// Every deps struct a handler can need, built once by the composition root.
|
||||
/// Use cases still receive only their own narrow struct — nothing takes `&Deps`.
|
||||
///
|
||||
/// `composition::build_deps` is called only from `crates/presentation/src/main.rs`.
|
||||
/// `bootstrap::build_deps` is called only from `bootstrap::build_server`.
|
||||
/// The worker-only groups this used to also carry now live in `WorkerDeps`, built by
|
||||
/// `composition::build_worker_deps` and consumed by `crates/worker/src/main.rs` —
|
||||
/// `crates/worker` no longer wires its own deps (its former `db.rs` is gone). Nothing
|
||||
/// `bootstrap::build_worker_deps` and consumed by `bootstrap::build_worker` —
|
||||
/// the worker binary no longer wires anything itself. Nothing
|
||||
/// in `Deps` below is worker-only anymore, except one field with no consumer anywhere
|
||||
/// in the workspace — see its comment.
|
||||
pub struct Deps {
|
||||
@@ -188,7 +188,7 @@ pub struct WorkerServices {
|
||||
pub person_enrichment: Option<Arc<dyn PersonEnrichmentClient>>,
|
||||
}
|
||||
|
||||
/// The deps structs the worker binary needs, built by `composition::build_worker_deps`.
|
||||
/// The deps structs the worker binary needs, built by `bootstrap::build_worker_deps`.
|
||||
/// These are the five groups that moved out of `Deps` during worker unification —
|
||||
/// they have no consumer the server binary can ever reach.
|
||||
pub struct WorkerDeps {
|
||||
|
||||
Reference in New Issue
Block a user