Skip to content

Commit

Permalink
Allow Ecto repo configuration via an URL
Browse files Browse the repository at this point in the history
This allows the use of SSL for connecting to the database.
  • Loading branch information
vloothuis committed Aug 15, 2023
1 parent 30f0530 commit 1c13159
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions core/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@ if config_env() == :prod do
config :core, :azure_storage_backend, sas_token: sas_token
end

config :core, Core.Repo,
username: System.get_env("DB_USER"),
password: System.get_env("DB_PASS"),
database: System.get_env("DB_NAME"),
hostname: System.get_env("DB_HOST")
database_url = System.get_env("DB_URL")

if database_url do
config :core, Core.Repo, url: database_url
else
config :core, Core.Repo,
username: System.get_env("DB_USER"),
password: System.get_env("DB_PASS"),
database: System.get_env("DB_NAME"),
hostname: System.get_env("DB_HOST")
end

config :core, GoogleSignIn,
redirect_uri: "https://#{host}/google-sign-in/auth",
Expand Down

0 comments on commit 1c13159

Please sign in to comment.