Skip to content

Commit

Permalink
Allow CDN_PKG_PATH at runtime as well as current build time, preferri…
Browse files Browse the repository at this point in the history
…ng it when available.
  • Loading branch information
zakstucke committed Mar 25, 2024
1 parent f3d19ca commit 2c06b96
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions integrations/utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@ pub fn html_parts_separated(
options: &LeptosOptions,
meta: Option<&MetaContext>,
) -> (String, &'static str) {
let pkg_path = option_env!("CDN_PKG_PATH")
.map(Cow::from)
.unwrap_or_else(|| format!("/{}", options.site_pkg_dir).into());
// First check runtime env, then build time, then default:
let pkg_path = match std::env::var("CDN_PKG_PATH").ok().map(Cow::from) {
Some(path) => path,
None => {
match option_env!("CDN_PKG_PATH").map(Cow::from) {
Some(path) => path,
None => format!("/{}", options.site_pkg_dir).into(),
}
}
};
let output_name = &options.output_name;
let nonce = use_nonce();
let nonce = nonce
Expand Down

0 comments on commit 2c06b96

Please sign in to comment.