1.5 KiB
1.5 KiB
028 — Bundle the webapp with fs-embed, drop --static-dir
Summary
fs-embed is already a Cargo.toml dependency but unused (grep -rn "fs_embed" src/ turns up nothing) — src/api.rs still serves the webapp via
ServeDir/ServeFile pointed at a --static-dir CLI arg
(src/main.rs:35), which requires shipping webapp/dist alongside the
binary. Embed the built webapp into the binary instead so ottyl is a single
self-contained executable.
Scope
- Use
fs-embedto embedwebapp/distat build time. - Wire the embedded filesystem into
src/api.rsin place of theServeDir::new(static_dir).fallback(ServeFile::new(index_html))setup (src/api.rs:100-101), preserving the SPA fallback-to-index.htmlbehavior. - Remove the
--static-dirclap arg (src/main.rs:30-35) and its plumbing throughapi::router(src/api.rs:91,src/main.rs:108). - Update the test helper that builds a router against a temp static dir
(
src/api.rs:729-744) to match the new embedding approach. webapp/distmust exist atcargo buildtime (i.e. the webapp build step stays a prerequisite) — document that in the README's build instructions if not already covered.
Acceptance criteria
cargo build(withwebapp/distpresent) produces a binary that serves the webapp with no--static-dirflag and nowebapp/distdirectory needed at runtime.--static-dirno longer appears in--helpoutput orArgs.- Existing API tests pass against the embedded-filesystem router.
Depends on
None.