Load server config on react app
This commit is contained in:
@ -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(),
|
||||
|
Reference in New Issue
Block a user