Fix missed stuff (#2398)

This commit is contained in:
Ben Wishovich 2024-03-02 17:57:20 -08:00 committed by GitHub
parent 9fd2987447
commit 1da2fff706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 14 deletions

View File

@ -150,7 +150,7 @@ fn get_hashes(options: &LeptosOptions) -> (String, String, String) {
("css".to_string(), "".to_string()),
]);
if options.frontend_files_content_hashes {
if options.hash_files {
let hash_path = env::current_exe()
.map(|path| {
path.parent().map(|p| p.to_path_buf()).unwrap_or_default()

View File

@ -76,9 +76,9 @@ pub struct LeptosOptions {
pub hash_file: String,
/// If true, hashes will be generated for all files in the site_root and added to their file names.
/// Defaults to `true`.
#[builder(default = default_frontend_files_content_hashes())]
#[serde(default = "default_frontend_files_content_hashes")]
pub frontend_files_content_hashes: bool,
#[builder(default = default_hash_files())]
#[serde(default = "default_hash_files")]
pub hash_files: bool,
}
impl LeptosOptions {
@ -118,14 +118,7 @@ impl LeptosOptions {
)?,
not_found_path: env_w_default("LEPTOS_NOT_FOUND_PATH", "/404")?,
hash_file: env_w_default("LEPTOS_HASH_FILE_NAME", "hash.txt")?,
frontend_files_content_hashes: env_w_default(
"LEPTOS_FRONTEND_FILES_CONTENT_HASHES",
"ON",
)?
.to_uppercase()
.replace("ON", "true")
.replace("OFF", "false")
.parse()?,
hash_files: env_w_default("LEPTOS_HASH_FILES", "false")?.parse()?,
})
}
}
@ -168,8 +161,8 @@ fn default_hash_file_name() -> String {
"hash.txt".to_string()
}
fn default_frontend_files_content_hashes() -> bool {
true
fn default_hash_files() -> bool {
false
}
fn env_wo_default(key: &str) -> Result<Option<String>, LeptosConfigError> {