Skip to content

Commit 0097ac8

Browse files
Allow db to be configured by url (#1314)
1 parent 64ac910 commit 0097ac8

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

plural/helm/plural/values.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ admin:
325325
enabled: false
326326

327327
postgres:
328+
create: true
328329
plural:
329330
resources: {}
330331
size: 50Gi

rel/config/config.exs

+16-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@ config :core, Core.Guardian,
2323
issuer: "plural",
2424
secret_key: get_env("JWT_SECRET")
2525

26-
config :core, Core.Repo,
27-
database: "plural",
28-
username: "plural",
29-
password: get_env("POSTGRES_PASSWORD"),
30-
hostname: get_env("DBHOST") || "plural-postgresql",
31-
ssl: String.to_existing_atom(get_env("DBSSL") || "false"),
32-
pool_size: 5
26+
27+
28+
if get_env("POSTGRES_URL") do
29+
config :core, Core.Repo,
30+
url: get_env("POSTGRES_URL"),
31+
ssl: String.to_existing_atom(get_env("DBSSL") || "true"),
32+
pool_size: 5
33+
else
34+
config :core, Core.Repo,
35+
database: "plural",
36+
username: "plural",
37+
password: get_env("POSTGRES_PASSWORD"),
38+
hostname: get_env("DBHOST") || "plural-postgresql",
39+
ssl: String.to_existing_atom(get_env("DBSSL") || "false"),
40+
pool_size: 5
41+
end
3342

3443
config :cloudflare,
3544
auth_token: get_env("CLOUDFLARE_AUTH_TOKEN")

0 commit comments

Comments
 (0)