* fix: add CORS origin environment variable
* chore: formatting
---------
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
- lemmyexternalproxy
restart: always
environment:
+ # set this to the public origin that requests will come from
+ - LEMMY_CORS_ORIGIN=http://localhost
- RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
- RUST_BACKTRACE=full
volumes:
.build()
.expect("configure federation");
+ let cors_origin = std::env::var("LEMMY_CORS_ORIGIN").unwrap_or_default();
+
let cors_config = if cfg!(debug_assertions) {
Cors::permissive()
} else {
- Cors::default()
+ Cors::default().allowed_origin(&cors_origin)
};
App::new()