forked from Hubs-Foundation/reticulum
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathruntime.exs.template
70 lines (55 loc) · 2.08 KB
/
runtime.exs.template
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import Config
config :ret, :logging_url, "${LOGGING_URL}"
config :ret, RetWeb.Plugs.PostgrestProxy,
hostname: System.get_env("POSTGREST_INTERNAL_HOSTNAME", "localhost")
case config_env() do
:dev ->
db_hostname = System.get_env("DB_HOST", "localhost")
dialog_hostname = System.get_env("DIALOG_HOSTNAME", "dev-janus.reticulum.io")
hubs_admin_internal_hostname = System.get_env("HUBS_ADMIN_INTERNAL_HOSTNAME", "hubs.local")
hubs_client_internal_hostname = System.get_env("HUBS_CLIENT_INTERNAL_HOSTNAME", "hubs.local")
spoke_internal_hostname = System.get_env("SPOKE_INTERNAL_HOSTNAME", "hubs.local")
dialog_port =
"DIALOG_PORT"
|> System.get_env("443")
|> String.to_integer()
perms_key =
"PERMS_KEY"
|> System.get_env("")
|> String.replace("\\n", "\n")
config :ret, Ret.JanusLoadStatus, default_janus_host: dialog_hostname, janus_port: dialog_port
config :ret, Ret.Locking,
session_lock_db: [
database: "ret_dev",
hostname: db_hostname,
username: "${DB_USER}",
password: "${DB_PASSWORD}"
]
config :ret, Ret.PermsToken, perms_key: perms_key
config :ret, Ret.PageOriginWarmer,
admin_page_origin: "https://#{hubs_admin_internal_hostname}:8989",
hubs_page_origin: "https://#{hubs_client_internal_hostname}:8080",
spoke_page_origin: "https://#{spoke_internal_hostname}:9090"
config :ret, Ret.Repo, hostname: db_hostname
config :ret, Ret.SessionLockRepo, hostname: db_hostname
:test ->
db_credentials = System.get_env("DB_CREDENTIALS", "admin")
db_hostname = System.get_env("DB_HOST", "localhost")
config :ret, Ret.Repo,
hostname: db_hostname,
password: db_credentials,
username: db_credentials
config :ret, Ret.SessionLockRepo,
hostname: db_hostname,
password: db_credentials,
username: db_credentials
config :ret, Ret.Locking,
session_lock_db: [
database: "ret_test",
hostname: db_hostname,
password: db_credentials,
username: db_credentials
]
_ ->
:ok
end