feat: add --topic flag to load handler from xs store#37
Merged
Conversation
Load the request handler from a store topic instead of a file. When combined with -w, the server tails the topic and hot-reloads on updates. If the topic is empty, a 503 placeholder page is served with instructions for populating it via xs append. Also fixes -c to conflict with the script positional at the clap level and removes square brackets from the preamble options line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--topic
--topicruns the server with a handler closure stored on the xs stream instead of from a file. Requires--store.With
-w, the server tails the topic and reloads when it's updated:When the topic is empty, a placeholder closure serves a 503 with instructions. The placeholder lives at
examples/topic-placeholder.nuand is baked into the binary viainclude_str!.Other changes
-cnow conflicts withscriptat the clap level (was runtime only)src/store.rs; CLI args gated behind#[cfg(feature = "cross-stream")]file_source,stdin_source, andStore::topic_sourcefollow the same shape — send initial script, optionally spawn watcher