Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(inspector-ui): add an option to disable inspector ui #28

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ use crate::{cli::FeedDefinition, util::Result};
pub struct ServerConfig {
#[clap(long, short, default_value = "127.0.0.1:4080")]
bind: String,
#[clap(
long,
action = clap::ArgAction::Set,
num_args = 0..=1,
require_equals = true,
default_value = "true",
default_missing_value = "true"
)]
inspector_ui: bool,
}

pub async fn serve(
Expand All @@ -31,8 +40,13 @@ pub async fn serve(
app = app.merge(endpoint_route);
}

if server_config.inspector_ui {
app = app.nest("/", inspector::router(feed_definition))
} else {
app = app.route("/", get(|| async { "rss-funnel is up and running!" }));
}

app = app
.nest("/", inspector::router(feed_definition))
.route("/health", get(|| async { "ok" }))
.fallback(get(|| async {
(StatusCode::NOT_FOUND, "Endpoint not found")
Expand Down
Loading