Load server config on react app

This commit is contained in:
2023-06-06 15:47:30 +02:00
parent ec98e728d8
commit 8f0a3e1f07
10 changed files with 170 additions and 38 deletions

View File

@ -1,3 +1,4 @@
use actix_cors::Cors;
use actix_remote_ip::RemoteIPConfig;
use actix_web::middleware::Logger;
use actix_web::{web, App, HttpServer};
@ -12,6 +13,14 @@ async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.wrap(
Cors::default()
.allowed_origin(&AppConfig::get().website_origin)
.allowed_methods(vec!["GET", "POST"])
.allowed_header("X-Auth-Token")
.supports_credentials()
.max_age(3600),
)
.wrap(Logger::default())
.app_data(web::Data::new(RemoteIPConfig {
proxy: AppConfig::get().proxy_ip.clone(),