fix embed frontend optional
This commit is contained in:
parent
b2fc004c64
commit
29b8c5bce8
@ -29,6 +29,9 @@ use api::{auth, routes::*};
|
|||||||
use db::{db_pool, models::LoginUser};
|
use db::{db_pool, models::LoginUser};
|
||||||
use utils::{args_parse::Args, control::ProcessControl, db_path, init_config, run_args};
|
use utils::{args_parse::Args, control::ProcessControl, db_path, init_config, run_args};
|
||||||
|
|
||||||
|
#[cfg(any(debug_assertions, not(feature = "embed_frontend")))]
|
||||||
|
use utils::public_path;
|
||||||
|
|
||||||
use ffplayout_lib::utils::{init_logging, PlayoutConfig};
|
use ffplayout_lib::utils::{init_logging, PlayoutConfig};
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
@ -178,11 +181,11 @@ async fn main() -> std::io::Result<()> {
|
|||||||
web_app.service(ResourceFiles::new("/", generated).resolve_not_found_to_root());
|
web_app.service(ResourceFiles::new("/", generated).resolve_not_found_to_root());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(any(debug_assertions, not(feature = "embed_frontend")))]
|
||||||
{
|
{
|
||||||
// in debug mode get frontend from path
|
// in debug mode get frontend from path
|
||||||
web_app = web_app.service(
|
web_app = web_app.service(
|
||||||
Files::new("/", "./ffplayout-frontend/.output/public/")
|
Files::new("/", public_path())
|
||||||
.index_file("index.html"),
|
.index_file("index.html"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -169,6 +169,14 @@ pub fn public_path() -> PathBuf {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
{
|
||||||
|
let path = PathBuf::from("./ffplayout-frontend/.output/public/");
|
||||||
|
if path.is_dir() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PathBuf::from("./public/")
|
PathBuf::from("./public/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user