Skip to content

docs(env): note that / and /repos need BUZZ_SERVE_GIT_WEB_GUI - #3857

Open
TheSeydiCharyyev wants to merge 2 commits into
block:mainfrom
TheSeydiCharyyev:docs/env-example-web-gui-flag
Open

docs(env): note that / and /repos need BUZZ_SERVE_GIT_WEB_GUI#3857
TheSeydiCharyyev wants to merge 2 commits into
block:mainfrom
TheSeydiCharyyev:docs/env-example-web-gui-flag

Conversation

@TheSeydiCharyyev

Copy link
Copy Markdown
Contributor

Summary

The BUZZ_WEB_DIR comment in .env.example says that setting it makes the relay serve "the web frontend at / for browser requests". Setting it alone does not do that, so anyone following the file ends up with a relay that answers / with JSON and concludes the web bundle is broken.

What the code actually does — crates/buzz-relay/src/router.rs:

fn should_serve_spa(path: &str, serve_git_web_gui: bool) -> bool {
    is_invite_landing_path(path) || (serve_git_web_gui && is_git_web_gui_path(path))
}

fn is_git_web_gui_path(path: &str) -> bool {
    path == "/" || path == "/repos" || path.starts_with("/repos/")
}

nip11_or_ws_handler gates its Accept: text/html branch for / on the same flag, and serve_git_web_gui is read from BUZZ_SERVE_GIT_WEB_GUI in crates/buzz-relay/src/config.rs with .unwrap_or(false). So with only BUZZ_WEB_DIR set, a browser requesting / gets the NIP-11 document.

/invite/{code} does work with BUZZ_WEB_DIR alone, since is_invite_landing_path is checked unconditionally. The comment now says that, and documents BUZZ_SERVE_GIT_WEB_GUI — which .env.example did not mention at all.

The wording follows the table already in TESTING.md, which describes both variables correctly today; this only brings .env.example in line with it.

Related issue

Fixes #3815. No open PR touches these lines — #3777 also edits .env.example, but adds BUZZ_ADMIN_WEB_DIR in a different section.

Testing

Documentation only; no code changes, so no behaviour to test. The claim is verified against the repository's own unit test rather than by reasoning alone — crates/buzz-relay/src/router.rs contains:

#[test]
fn invite_is_always_served_but_git_gui_requires_opt_in() {
    assert!(should_serve_spa("/invite/payload.mac", false));
    assert!(!should_serve_spa("/", false));
    assert!(!should_serve_spa("/repos/example", false));
    assert!(should_serve_spa("/", true));
    assert!(should_serve_spa("/repos/example", true));
}

That test is exactly the behaviour the old comment contradicted.

The BUZZ_WEB_DIR comment said setting it makes the relay serve "the web
frontend at / for browser requests". Setting it alone does not do that.

`should_serve_spa` in crates/buzz-relay/src/router.rs returns
`is_invite_landing_path(path) || (serve_git_web_gui && is_git_web_gui_path(path))`,
and `nip11_or_ws_handler` gates the `Accept: text/html` branch for / on the
same flag. `serve_git_web_gui` is read from BUZZ_SERVE_GIT_WEB_GUI and
defaults to false, so with only BUZZ_WEB_DIR set a browser hitting / gets the
NIP-11 document. The repo's own test says as much - router.rs has
`invite_is_always_served_but_git_gui_requires_opt_in`, asserting
`!should_serve_spa("/", false)` and `should_serve_spa("/", true)`.

Invite links do work with BUZZ_WEB_DIR alone, so the comment now says that
instead, and documents BUZZ_SERVE_GIT_WEB_GUI, which .env.example did not
mention at all. Wording follows the table already in TESTING.md, which
describes this correctly.

Fixes block#3815

Signed-off-by: Seydi Charyyev <seydi.charyev@gmail.com>
@TheSeydiCharyyev
TheSeydiCharyyev requested a review from a team as a code owner July 31, 2026 04:45
@Chessing234

Copy link
Copy Markdown
Contributor

good doc catch. can you also mention it next to BUZZ_SERVE_GIT_WEB_GUI so both comments point at each other?

Positional wording breaks if the lines ever move, so the BUZZ_WEB_DIR
comment now names BUZZ_SERVE_GIT_WEB_GUI directly.

Signed-off-by: Seydi Charyyev <seydi.charyev@gmail.com>
@TheSeydiCharyyev

Copy link
Copy Markdown
Contributor Author

Both comments are already adjacent and point at each other — this PR adds the BUZZ_SERVE_GIT_WEB_GUI block directly under BUZZ_WEB_DIR. The first says / and /repos/... additionally require the flag; the second says the flag has no effect unless BUZZ_WEB_DIR is set. There was no BUZZ_SERVE_GIT_WEB_GUI entry in .env.example before this PR, so there is no other place to link from.

One thing worth taking from it though: the first block said "the flag below", which breaks if the lines ever move. Pushed 5957f29 naming BUZZ_SERVE_GIT_WEB_GUI directly.

For reference, Dockerfile:147-149 and the TESTING.md table already describe this correctly — .env.example was the only place that did not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.env.example: BUZZ_WEB_DIR comment implies it alone serves the web frontend at /, but BUZZ_SERVE_GIT_WEB_GUI is also required

2 participants