This commit is contained in:
Greg Johnston 2022-12-29 08:02:56 -05:00
parent f47fad3ed5
commit a603531409

View file

@ -15,9 +15,9 @@ pub struct ConfFile {
pub leptos_options: LeptosOptions,
}
/// This struct serves as a convenient place to store details used for configuring Leptos.
/// It's used in our actix and axum integrations to generate the
/// It's used in our actix and axum integrations to generate the
/// correct path for WASM, JS, and Websockets, as well as other configuration tasks.
/// It shares keys with cargo-leptos, to allow for easy interoperability
/// It shares keys with cargo-leptos, to allow for easy interoperability
#[derive(TypedBuilder, Clone, serde::Deserialize)]
pub struct LeptosOptions {
/// The name of the WASM and JS files generated by wasm-bindgen. Defaults to the crate name with underscores instead of dashes
@ -46,9 +46,9 @@ pub struct LeptosOptions {
pub reload_port: u32,
}
/// An enum that can be used to define the environment Leptos is running in. Can be passed to RenderOptions.
/// Setting this to the PROD variant will not include the websockets code for cargo-leptos' watch.
/// Defaults to DEV
/// An enum that can be used to define the environment Leptos is running in. Can be passed to [RenderOptions].
/// Setting this to the `PROD` variant will not include the websockets code for `cargo-leptos` watch mode.
/// Defaults to `DEV`.
#[derive(Debug, Clone, serde::Deserialize)]
pub enum Env {
PROD,
@ -125,8 +125,8 @@ impl TryFrom<String> for Env {
}
}
}
/// Loads LeptosOptions from a Caego.toml with layered overrides. If an en var is specified, like LEPTOS_ENV,
/// it will override a setting in the file. Returns a `ConfFile, which contains `
/// Loads [LeptosOptions] from a Cargo.toml with layered overrides. If an env var is specified, like `LEPTOS_ENV`,
/// it will override a setting in the file.
pub async fn get_configuration(path: Option<&str>) -> Result<ConfFile, LeptosConfigError> {
// Allow Cargo.toml path to be specified in case of workspace wonkiness
let text = match path {