GeneIT/geneit_backend/src/controllers/server_controller.rs

31 lines
833 B
Rust
Raw Normal View History

use crate::app_config::{AppConfig, OIDCProvider};
use crate::constants::StaticConstraints;
use actix_web::{HttpResponse, Responder};
/// Default hello route
pub async fn home() -> impl Responder {
HttpResponse::Ok().json("GeneIT API service.")
}
#[derive(Debug, Clone, serde::Serialize)]
2023-06-02 09:49:18 +00:00
struct ServerConfig<'a> {
constraints: StaticConstraints,
mail: &'static str,
2023-06-02 09:49:18 +00:00
oidc_providers: Vec<OIDCProvider<'a>>,
}
2023-06-02 09:49:18 +00:00
impl Default for ServerConfig<'_> {
fn default() -> Self {
Self {
mail: AppConfig::get().mail_sender.as_str(),
constraints: StaticConstraints::default(),
oidc_providers: AppConfig::get().openid_providers(),
}
}
}
/// Get server configuration
pub async fn server_config() -> impl Responder {
HttpResponse::Ok().json(ServerConfig::default())
}