webserver_base/lib.rs
1//! Shared logic for Todd Everett Griffin's web servers, as a set of
2//! independently feature-gated **kits**.
3//!
4//! Every kit works on its own — a bot that wants only Telegram notifications
5//! enables `telegram` and compiles neither axum nor Handlebars. Together they
6//! compose into one opinionated web server. Nothing is enabled by default.
7//!
8//! | feature | what it is |
9//! |---|---|
10//! | `templates` | Handlebars registry, the embedded base layout, template data |
11//! | `analytics` | first-party proxies for Plausible and the Sentry browser SDK |
12//! | `sitemap` | sitemap index and url-set generation |
13//! | `observability` | Sentry + tracing, initialised in the one order that works |
14//! | `telegram` | outbound Telegram Bot API notifier |
15//! | `webserver` | the server builder, state, bootstrap, static-asset pipeline |
16//! | `pages` | page declarations that produce routes *and* sitemap entries |
17//! | `preset` | Todd Everett Griffin's personal defaults |
18//! | `full` | all of the above |
19//!
20//! # Configuration
21//!
22//! Every kit is constructed manually first; `from_env` is a convenience layered
23//! on top. All environment variables this crate reads are prefixed `WSB_` so
24//! they cannot collide with a project's own.
25
26pub mod env;
27mod environment;
28
29pub use environment::{ENV_ENVIRONMENT, Environment, EnvironmentParseError};
30
31#[cfg(feature = "analytics")]
32pub mod analytics;
33#[cfg(feature = "webserver")]
34pub mod assets;
35#[cfg(feature = "observability")]
36pub mod observability;
37#[cfg(feature = "sitemap")]
38pub mod sitemap;
39#[cfg(feature = "telegram")]
40pub mod telegram;
41#[cfg(feature = "templates")]
42pub mod templates;
43#[cfg(feature = "webserver")]
44pub mod webserver;
45
46#[cfg(feature = "webserver")]
47pub use webserver::{Shutdown, WebServer, WebServerError, WebServerState, bootstrap_with_release};