Can build central in production mode

This commit is contained in:
2024-08-07 16:44:30 +02:00
parent 48a2f728de
commit e18162b32d
8 changed files with 154 additions and 3 deletions

View File

@ -6,6 +6,7 @@ use crate::server::auth_middleware::AuthChecker;
use crate::server::devices_api::{mgmt_controller, utils_controller};
use crate::server::unsecure_server::*;
use crate::server::web_api::*;
use crate::server::web_app_controller;
use actix_cors::Cors;
use actix_identity::config::LogoutBehaviour;
use actix_identity::IdentityMiddleware;
@ -105,7 +106,7 @@ pub async fn secure_server(energy_actor: EnergyActorAddr) -> anyhow::Result<()>
.app_data(web::Data::new(RemoteIPConfig {
proxy: AppConfig::get().proxy_ip.clone(),
}))
.route("/", web::get().to(server_controller::secure_home))
//.route("/", web::get().to(server_controller::secure_home))
// Web API
// Server controller
.route(
@ -181,6 +182,13 @@ pub async fn secure_server(energy_actor: EnergyActorAddr) -> anyhow::Result<()>
"/devices_api/mgmt/get_certificate",
web::get().to(mgmt_controller::get_certificate),
)
// Web app
.route("/", web::get().to(web_app_controller::root_index))
.route(
"/assets/{tail:.*}",
web::get().to(web_app_controller::serve_assets_content),
)
.route("/{tail:.*}", web::get().to(web_app_controller::root_index))
})
.bind_openssl(&AppConfig::get().listen_address, builder)?
.run()