Skip to content

feat: provide api to customize server address#5473

Open
seflue wants to merge 1 commit into
DioxusLabs:mainfrom
seflue:feat/serve-with-address
Open

feat: provide api to customize server address#5473
seflue wants to merge 1 commit into
DioxusLabs:mainfrom
seflue:feat/serve-with-address

Conversation

@seflue
Copy link
Copy Markdown
Contributor

@seflue seflue commented Apr 9, 2026

Fixes #5263

Before 0.7, fullstack::Config::new().addr(...) allowed setting the server address programmatically. This was removed in the 0.7 refactoring, leaving IP/PORT env vars as the only option. On Rust edition 2024, that means calling unsafe { std::env::set_var(...) } before serve().

serve_at is a new entry point that takes a SocketAddr and a callback, which is just wrapped by serve(), so existing behavior is unchanged. It is re-exported as dioxus::serve_at and included in the prelude.

@seflue seflue requested a review from a team as a code owner April 9, 2026 16:55
@seflue seflue force-pushed the feat/serve-with-address branch 3 times, most recently from 4f4db3c to bbd7044 Compare April 29, 2026 19:29
@seflue seflue force-pushed the feat/serve-with-address branch 2 times, most recently from f9bf068 to 7bc3284 Compare May 14, 2026 10:12
Users who need to control the server address
programmatically are forced to use
std::env::set_var("PORT", ...), which is unsafe
in Rust edition 2024.

Adds serve_at(addr, cb) as a safe alternative.
serve() now delegates to it internally.
@seflue seflue force-pushed the feat/serve-with-address branch from 7bc3284 to 1eeea20 Compare May 15, 2026 23:35
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.

Assigning a port number / bind address when using LaunchBuilder

1 participant