mirror of
https://github.com/leptos-rs/leptos
synced 2024-09-20 06:21:57 +00:00
fix: allow server functions to work with non-Cargo build systems with SERVER_FN_OVERRIDE_KEY
env var (#878)
This commit is contained in:
parent
efbe32e081
commit
6753ba21c4
1 changed files with 6 additions and 1 deletions
|
@ -194,6 +194,11 @@ pub fn server_macro_impl(
|
|||
.map(|path| quote!(#path))
|
||||
.unwrap_or_else(|| quote! { server_fn });
|
||||
|
||||
let key_env_var = match option_env!("SERVER_FN_OVERRIDE_KEY") {
|
||||
Some(_) => "SERVER_FN_OVERRIDE_KEY",
|
||||
None => "CARGO_MANIFEST_DIR",
|
||||
};
|
||||
|
||||
Ok(quote::quote! {
|
||||
#[derive(Clone, Debug, ::serde::Serialize, ::serde::Deserialize)]
|
||||
pub struct #struct_name {
|
||||
|
@ -208,7 +213,7 @@ pub fn server_macro_impl(
|
|||
}
|
||||
|
||||
fn url() -> &'static str {
|
||||
#server_fn_path::const_format::concatcp!(#fn_name_as_str, #server_fn_path::xxhash_rust::const_xxh64::xxh64(concat!(env!("CARGO_MANIFEST_DIR"), ":", file!(), ":", line!(), ":", column!()).as_bytes(), 0))
|
||||
#server_fn_path::const_format::concatcp!(#fn_name_as_str, #server_fn_path::xxhash_rust::const_xxh64::xxh64(concat!(env!(#key_env_var), ":", file!(), ":", line!(), ":", column!()).as_bytes(), 0))
|
||||
}
|
||||
|
||||
fn encoding() -> #server_fn_path::Encoding {
|
||||
|
|
Loading…
Reference in a new issue