Skip to content

Commit

Permalink
Merge branch 'master' into add-notification-schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
tspenov authored Oct 28, 2024
2 parents 6e2d13a + 5de479a commit 5cb2ee7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 0 additions & 13 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
import Config

if config_env() == :dev do
{ssl, ssl_opts} =
if System.get_env("DATABASE_URL") do
{true, [verify: :verify_none]}
else
{false, []}
end

config :sanbase, Sanbase.Repo,
ssl: ssl,
ssl_opts: ssl_opts
end

if config_env() in [:dev, :test] do
# In order to properly work while developing locally,
# load the .env file before doing the configuration
Expand Down
11 changes: 11 additions & 0 deletions lib/sanbase/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ defmodule Sanbase.Repo do
|> Keyword.put(:pool_size, pool_size)
|> Keyword.put(:url, System.get_env("DATABASE_URL"))

test_env? = Application.get_env(:sanbase, :env) == :test

opts =
if is_nil(System.get_env("DATABASE_URL")) or test_env? do
opts
else
opts
|> Keyword.put(:ssl, true)
|> Keyword.put(:ssl_opts, verify: :verify_none)
end

{:ok, opts}
end
end

0 comments on commit 5cb2ee7

Please sign in to comment.