LINKS-13: Unify standalone and saas builds into a single runtime-mode binary #50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/unify-standalone-saas-runtime-mode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
LINKS-13: Unify standalone and saas builds into a single binary with runtime mode selection
Replaces the compile-time
standalone/saassplit with one binary and one OCI image whose deployment mode is resolved at runtime fromOIDC_ISSUER(set = hosted OIDC mode, unset = standalone local-JWT mode).Server
Cargo.toml: removed both[[bin]]targets and thestandalone/saasfeatures; singlerusty-linksbinary,default = [].config.rs: addedConfig::hosted()(mirrorsOidcConfig::enabled), load all config sections unconditionally, load a plain.env.main.rs: converted every#[cfg]block to a runtime branch onconfig.hosted()(default-admin bootstrap, page-guard middleware, OIDC RP router merge, landing page, maintenance guard). Maintenance state and the OIDC verifier are always carried inAppStateand stay inert in standalone mode.api/mod.rs:create_routermounts the standalone auth/admin routes only when not hosted, and the maintenance webhook (plus the verifier extension) only when hosted. Runtime mount, not runtime 403, so endpoints unavailable in a mode return 404.auth/middleware.rs: merged the twoAuthenticatedUserextractors into one impl that dispatches at runtime (JWT bearer in standalone;rl_sessioncookie orat+jwtbearer in hosted).api/auth.rs: one unifiedmehandler.models/user.rs: password hashing/verification compile unconditionally.scheduler: OIDC session cleanup gated onhosted().auth/mod.rs: all submodules compile unconditionally.Client (WASM)
/api/healthnow reportsauth_mode("standalone"|"hosted").app.rs: fetches the mode once viause_resourceinto a context provider;Login,Setup, and the navbar logout branch on it at runtime. The spinner-until-resolved pattern keeps hydration consistent (SSR and the initial WASM render both see the pending state).ui/http.rs: mode-agnostic; always sends cookies and attaches a bearer token when one is stored, so the same client works in both modes.Build & CI
oci-build/Dockerfile: singledx build --release; droppedBUILD_MODE, the feature/flag indirection, the output symlink, the binary rename, and theCARGO_BUILD_JOBS=nproc/2split (cargo now uses the full CPU count).build-oci-image.yml: dropped the matrix; builds and pushes onerusty-linksimage.check.yml: collapsed the two WASM checks into a singlecargo check --features web --target wasm32-unknown-unknown..env.standalone.example,.env.saas.example, andCLAUDE.mdupdated to describe runtime mode selection (OIDC_ISSUERis the switch). The hosted template now documents the realOIDC_*variables.Tests
tests/route_surface.rs: DB-free integration tests (lazy pool) asserting/api/healthreports the correctauth_modeand the per-mode route surface (hosted serves no local-auth/admin endpoints; standalone serves no maintenance webhook).Verification
cargo fmt --check,cargo clippy --all-targets -- -D warnings(default features),cargo check --features web --target wasm32-unknown-unknown,cargo build --all-targets,cargo test --lib(6) andcargo test --features server(135 lib + 6 route-surface) all pass. The 10 failing doctests are pre-existing illustrative examples inerror.rs/github/schedulerand are not run by CI (cargo test --lib).Note: the
/oauth2/*BFF routes are assembled inmain.rs(notapi::create_router) and are gated by the samehosted()switch validated by the route-surface tests.🤖 Generated with Claude Code