|
|
@ -150,12 +150,13 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> {
|
|
|
|
.build()
|
|
|
|
.build()
|
|
|
|
.expect("configure federation");
|
|
|
|
.expect("configure federation");
|
|
|
|
|
|
|
|
|
|
|
|
let cors_origin = std::env::var("LEMMY_CORS_ORIGIN").unwrap_or("http://localhost".into());
|
|
|
|
let cors_config = if cfg!(debug_assertions) {
|
|
|
|
|
|
|
|
|
|
|
|
let cors_config = if !cfg!(debug_assertions) {
|
|
|
|
|
|
|
|
Cors::permissive()
|
|
|
|
Cors::permissive()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Cors::default().allowed_origin(&cors_origin)
|
|
|
|
let cors_origin = std::env::var("LEMMY_CORS_ORIGIN").unwrap_or("http://localhost".into());
|
|
|
|
|
|
|
|
Cors::default()
|
|
|
|
|
|
|
|
.allowed_origin(&cors_origin)
|
|
|
|
|
|
|
|
.allowed_origin(&settings.get_protocol_and_hostname())
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
App::new()
|
|
|
|
App::new()
|
|
|
|