Add function to Config to output warnings
All checks were successful
Push Workflows / tailwind-build (push) Successful in 7s
Push Workflows / rustfmt (push) Successful in 9s
Push Workflows / docs (push) Successful in 20s
Push Workflows / test (push) Successful in 24s
Push Workflows / clippy (push) Successful in 19s
Push Workflows / build (push) Successful in 47s
Push Workflows / nix-build (push) Successful in 5m18s
All checks were successful
Push Workflows / tailwind-build (push) Successful in 7s
Push Workflows / rustfmt (push) Successful in 9s
Push Workflows / docs (push) Successful in 20s
Push Workflows / test (push) Successful in 24s
Push Workflows / clippy (push) Successful in 19s
Push Workflows / build (push) Successful in 47s
Push Workflows / nix-build (push) Successful in 5m18s
This commit is contained in:
@@ -235,6 +235,32 @@ impl Config {
|
|||||||
.set_default("auth.cookies_secure", DEFAULT_COOKIES_SECURE)?
|
.set_default("auth.cookies_secure", DEFAULT_COOKIES_SECURE)?
|
||||||
.set_default("server.public_path", default_public_dir())
|
.set_default("server.public_path", default_public_dir())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Log any configuration-related warning messages, such as differences between user-configured
|
||||||
|
/// values and those supplied by the Dioxus CLI
|
||||||
|
pub fn log_warnings(&self) {
|
||||||
|
if let Some(dx_port) = dioxus::cli_config::server_port()
|
||||||
|
&& dx_port != self.server.port
|
||||||
|
{
|
||||||
|
tracing::warn!(
|
||||||
|
"Your configured server port ({}) doesn't match the one specified from environment \
|
||||||
|
variables set by the Dioxus CLI ({dx_port}). If you are intending to use the dx tool, \
|
||||||
|
please do not specify a port in the configuration.",
|
||||||
|
self.server.port
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Ok(dx_public_path) = std::env::var("DIOXUS_PUBLIC_PATH")
|
||||||
|
&& dx_public_path != self.server.public_path
|
||||||
|
{
|
||||||
|
tracing::warn!(
|
||||||
|
"Your configured server public path ({}) doesn't match the one specified from environment \
|
||||||
|
variables set by the Dioxus CLI ({dx_public_path}). If you are intending to use the dx tool, \
|
||||||
|
please do not specify a public_path in the configuration.",
|
||||||
|
self.server.public_path.display()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provide a sane default for the public path, using the same sources as Dioxus does internally.
|
/// Provide a sane default for the public path, using the same sources as Dioxus does internally.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use dioxus::{
|
use dioxus::{
|
||||||
cli_config,
|
|
||||||
fullstack::axum::{self, Router, middleware::from_fn},
|
fullstack::axum::{self, Router, middleware::from_fn},
|
||||||
prelude::{DioxusRouterExt, ServeConfig},
|
prelude::{DioxusRouterExt, ServeConfig},
|
||||||
server::axum::Extension,
|
server::axum::Extension,
|
||||||
@@ -26,6 +25,7 @@ pub async fn main() -> Result<std::convert::Infallible> {
|
|||||||
.err_context("Failed to load config")?;
|
.err_context("Failed to load config")?;
|
||||||
|
|
||||||
tracing::debug!("Loaded configuration: {config:#?}");
|
tracing::debug!("Loaded configuration: {config:#?}");
|
||||||
|
config.log_warnings();
|
||||||
|
|
||||||
// Dioxus doesn't expose a way to configure the public path other than this environment
|
// Dioxus doesn't expose a way to configure the public path other than this environment
|
||||||
// variable, and also doesn't provide a way to read what the public path is. As a workaround we
|
// variable, and also doesn't provide a way to read what the public path is. As a workaround we
|
||||||
@@ -59,18 +59,6 @@ pub async fn main() -> Result<std::convert::Infallible> {
|
|||||||
|
|
||||||
let auth_layer = build_auth_layer(db_pool.clone(), key_val_pool, config.auth.cookies_secure);
|
let auth_layer = build_auth_layer(db_pool.clone(), key_val_pool, config.auth.cookies_secure);
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
if let Some(dx_port) = cli_config::server_port()
|
|
||||||
&& dx_port != config.server.port
|
|
||||||
{
|
|
||||||
tracing::warn!(
|
|
||||||
"Your configured server port ({}) doesn't match the one specified from environment \
|
|
||||||
variables set by the Dioxus CLI ({dx_port}). If you are intending to use the dx tool, \
|
|
||||||
please do not specify a port in the configuration.",
|
|
||||||
config.server.port
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let addr = config.server.serve_addr();
|
let addr = config.server.serve_addr();
|
||||||
|
|
||||||
tracing::info!("Setup complete, building router...");
|
tracing::info!("Setup complete, building router...");
|
||||||
|
|||||||
Reference in New Issue
Block a user