aboutsummaryrefslogtreecommitdiff
path: root/config/runtime.exs
blob: 65f7b0a78116af399447fa0776777c74f884357c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Config

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", "#{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")