All checks were successful
continuous-integration/drone/push Build is passing
33 lines
864 B
Rust
33 lines
864 B
Rust
use crate::app_config::AppConfig;
|
|
use crate::constants::StaticConstraints;
|
|
use actix_web::HttpResponse;
|
|
|
|
pub async fn secure_home() -> HttpResponse {
|
|
HttpResponse::Ok()
|
|
.content_type("text/plain")
|
|
.body("SolarEnergy secure central backend")
|
|
}
|
|
|
|
#[derive(serde::Serialize)]
|
|
struct ServerConfig {
|
|
auth_disabled: bool,
|
|
constraints: StaticConstraints,
|
|
unsecure_origin: String,
|
|
backend_version: &'static str,
|
|
}
|
|
|
|
impl Default for ServerConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
auth_disabled: AppConfig::get().unsecure_disable_login,
|
|
constraints: Default::default(),
|
|
unsecure_origin: AppConfig::get().unsecure_origin(),
|
|
backend_version: env!("CARGO_PKG_VERSION"),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub async fn config() -> HttpResponse {
|
|
HttpResponse::Ok().json(ServerConfig::default())
|
|
}
|