make embed frontend optional

This commit is contained in:
jb-alvarado 2024-02-08 08:13:53 +01:00
parent 5064e46a85
commit 0188db3d0e
3 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,10 @@ authors.workspace = true
repository.workspace = true
edition.workspace = true
[features]
default = ["embed_frontend"]
embed_frontend = []
[dependencies]
ffplayout-lib = { path = "../lib" }
actix-files = "0.6"

View File

@ -1,7 +1,7 @@
use static_files::NpmBuild;
fn main() -> std::io::Result<()> {
if !cfg!(debug_assertions) {
if !cfg!(debug_assertions) && cfg!(feature = "embed_frontend") {
NpmBuild::new("../ffplayout-frontend")
.install()?
.run("generate")?

View File

@ -12,6 +12,7 @@ use actix_web_grants::authorities::AttachAuthorities;
use actix_web_httpauth::{extractors::bearer::BearerAuth, middleware::HttpAuthentication};
#[cfg(not(debug_assertions))]
#[cfg(feature = "embed_frontend")]
use actix_web_static_files::ResourceFiles;
use clap::Parser;
@ -31,6 +32,7 @@ use utils::{args_parse::Args, control::ProcessControl, db_path, init_config, run
use ffplayout_lib::utils::{init_logging, PlayoutConfig};
#[cfg(not(debug_assertions))]
#[cfg(feature = "embed_frontend")]
include!(concat!(env!("OUT_DIR"), "/generated.rs"));
lazy_static! {
@ -168,6 +170,7 @@ async fn main() -> std::io::Result<()> {
}
#[cfg(not(debug_assertions))]
#[cfg(feature = "embed_frontend")]
{
// in release mode embed frontend
let generated = generate();