Skip to content

Commit

Permalink
config fix, check if Watcher Info config value
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Nov 23, 2020
1 parent c8ce7c7 commit e110584
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions config/releases.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ import Config
#
# See https://hexdocs.pm/mix/1.9.0/Mix.Tasks.Release.html#module-runtime-configuration

mandatory = fn env, exception ->
case System.get_env(env) do
nil -> throw(exception)
data -> data
end
mandatory = fn
env, exception, true, true ->
case System.get_env(env) do
nil -> throw(exception)
data -> data
end
env, exception, false, true ->
"WATCHER_INFO config in WATCHER SECURITY"
end

watcher_info? = fn -> Code.ensure_loaded?(OMG.WatcherInfo) end

config :omg_watcher_info, OMG.WatcherInfo.DB.Repo,
url: mandatory.("DATABASE_URL", "DATABASE_URL needs to be set."),
url: mandatory.("DATABASE_URL", "DATABASE_URL needs to be set.", watcher_info?.(), true),
# Have at most `:pool_size` DB connections on standby and serving DB queries.
pool_size: String.to_integer(System.get_env("WATCHER_INFO_DB_POOL_SIZE") || "10"),
# Wait at most `:queue_target` for a connection. If all connections checked out during
Expand Down

0 comments on commit e110584

Please sign in to comment.