diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2024-07-26 14:20:14 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2024-07-26 14:23:53 +0000 |
commit | cd794243a5bba358d995e26ba024268e7d5d3f85 (patch) | |
tree | 2df6974cc40f736441f7b985ca95a7f897f4510e /config | |
parent | 37ab5213a368926506206cb21a438cb7fea3d530 (diff) | |
download | mediasync-cd794243a5bba358d995e26ba024268e7d5d3f85.tar mediasync-cd794243a5bba358d995e26ba024268e7d5d3f85.tar.gz mediasync-cd794243a5bba358d995e26ba024268e7d5d3f85.zip |
Add Discord Activity functionality (mostly) + general improvements
Diffstat (limited to 'config')
-rw-r--r-- | config/runtime.exs | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/config/runtime.exs b/config/runtime.exs index 5c600db..65f7b0a 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,13 +1,42 @@ import Config -{:ok, sqids} = Sqids.new() +default_port = 8000 + +enable_discord_activity? = + Mediasync.Utils.int_repr_to_bool( + String.to_integer(System.get_env("MEDIASYNC_ENABLE_DISCORD_ACTIVITY", "0")) + ) + +websocket_origin = + MapSet.new( + String.split( + System.get_env( + "MEDIASYNC_WEBSOCKET_ORIGIN", + "http://localhost:#{default_port} http://127.0.0.1:#{default_port}" + ) + ) + ) + +discord_client_id = + if enable_discord_activity? do + System.fetch_env!("MEDIASYNC_DISCORD_CLIENT_ID") + end + +websocket_origin = + if enable_discord_activity? do + MapSet.put(websocket_origin, "https://#{discord_client_id}.discordsays.com") + else + websocket_origin + end config :mediasync, - port: String.to_integer(System.get_env("MEDIASYNC_PORT", "8000")), - node_id: Sqids.encode!(sqids, [String.to_integer(System.get_env("MEDIASYNC_NODE_ID", "1"))]), + port: String.to_integer(System.get_env("MEDIASYNC_PORT", "#{default_port}")), + websocket_origin: websocket_origin, max_rooms: :infinity, max_video_url_size: 2048, websocket_max_frame_octets: 10_000, + enable_discord_activity?: enable_discord_activity?, + discord_client_id: discord_client_id, secret_key_base: System.fetch_env!("MEDIASYNC_SECRET_KEY_BASE"), session_encryption_salt: System.fetch_env!("MEDIASYNC_SESSION_ENCRYPTION_SALT"), session_signing_salt: System.fetch_env!("MEDIASYNC_SESSION_SIGNING_SALT") |