Get server address from dioxus-cli-config. (#3494)

This commit is contained in:
charles-r-earp authored and GitHub committed 2025-01-07 13:39:25 -08:00
1 parent 273b70e9d6
commit b348a725de
2 files changed
+15 -2

No files matched your search

+14 -1
View File
@@ -11,6 +11,7 @@ publish = false
dioxus-web = { workspace = true, features = ["hydrate"], optional = true } dioxus-web = { workspace = true, features = ["hydrate"], optional = true }
dioxus = { features = ["fullstack"], workspace = true } dioxus = { features = ["fullstack"], workspace = true }
dioxus-fullstack = { workspace = true } dioxus-fullstack = { workspace = true }
dioxus-cli-config = { workspace = true, optional = true }
axum = { workspace = true, optional = true } axum = { workspace = true, optional = true }
tokio = { workspace = true, features = ["full"], optional = true } tokio = { workspace = true, features = ["full"], optional = true }
tower-http = { workspace = true, features = ["auth"], optional = true } tower-http = { workspace = true, features = ["auth"], optional = true }
@@ -43,5 +44,17 @@ optional = true
[features] [features]
default = [] default = []
server = ["axum", "tokio", "dioxus-fullstack/axum", "tower-http", "async-trait", "sqlx", "axum_session", "axum_session_auth", "http", "tower"] server = [
"dioxus-cli-config",
"axum",
"tokio",
"dioxus-fullstack/axum",
"tower-http",
"async-trait",
"sqlx",
"axum_session",
"axum_session_auth",
"http",
"tower",
]
web = ["dioxus-web"] web = ["dioxus-web"]
+1 -1
View File
@@ -64,7 +64,7 @@ fn main() {
.layer(axum_session::SessionLayer::new(session_store)); .layer(axum_session::SessionLayer::new(session_store));
// run it // run it
let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 3000)); let addr = dioxus_cli_config::fullstack_address_or_localhost();
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service()) axum::serve(listener, app.into_make_service())