On server config route, add OIDC config
This commit is contained in:
geneit_backend/src
@ -1,17 +0,0 @@
|
||||
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, Default)]
|
||||
struct StaticConfig {
|
||||
constraints: StaticConstraints,
|
||||
}
|
||||
|
||||
/// Get static configuration
|
||||
pub async fn static_config() -> impl Responder {
|
||||
HttpResponse::Ok().json(StaticConfig::default())
|
||||
}
|
@ -5,7 +5,7 @@ use actix_web::HttpResponse;
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
|
||||
pub mod auth_controller;
|
||||
pub mod config_controller;
|
||||
pub mod server_controller;
|
||||
pub mod user_controller;
|
||||
|
||||
/// Custom error to ease controller writing
|
||||
|
30
geneit_backend/src/controllers/server_controller.rs
Normal file
30
geneit_backend/src/controllers/server_controller.rs
Normal file
@ -0,0 +1,30 @@
|
||||
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)]
|
||||
struct ServerConfig {
|
||||
constraints: StaticConstraints,
|
||||
mail: &'static str,
|
||||
oidc_providers: Vec<OIDCProvider>,
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
Reference in New Issue
Block a user