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//! | `feed` | RSS 2.0, Atom 1.0 and JSON Feed for a site's content stream |
14//! | `observability` | Sentry + tracing, initialised in the one order that works |
15//! | `telegram` | outbound Telegram Bot API notifier |
16//! | `webserver` | the server builder, state, bootstrap, static-asset pipeline |
17//! | `pages` | page declarations that produce routes *and* sitemap entries |
18//! | `preset` | Todd Everett Griffin's personal defaults |
19//! | `full` | all of the above |
20//!
21//! # Configuration
22//!
23//! Every kit is constructed manually first; `from_env` is a convenience layered
24//! on top. All environment variables this crate reads are prefixed `WSB_` so
25//! they cannot collide with a project's own.
26
27pub mod env;
28mod environment;
29
30pub use environment::{ENV_ENVIRONMENT, Environment, EnvironmentParseError};
31
32#[cfg(feature = "analytics")]
33pub mod analytics;
34#[cfg(feature = "webserver")]
35pub mod assets;
36#[cfg(feature = "feed")]
37pub mod feed;
38#[cfg(feature = "observability")]
39pub mod observability;
40#[cfg(feature = "sitemap")]
41pub mod sitemap;
42#[cfg(feature = "telegram")]
43pub mod telegram;
44#[cfg(feature = "templates")]
45pub mod templates;
46#[cfg(feature = "webserver")]
47pub mod webserver;
48
49#[cfg(feature = "webserver")]
50pub use webserver::{
51 AppShutdown, Shutdown, WebServer, WebServerError, WebServerState, bootstrap_with_release,
52};