Skip to content

Commit

Permalink
change configuration to deal with empty string (#1844)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull authored Jan 2, 2024
1 parent 0c204ff commit bf4c2d4
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
import Config

config :cms, CMS.Cache,
conn_opts: [
host: System.get_env("REDIS_HOST", "127.0.0.1"),
port: 6379
],
stats: false,
telemetry: false
redis_host_env = System.get_env("REDIS_HOST", "127.0.0.1")

redis_host =
if redis_host_env == "",
do: "127.0.0.1",
else: redis_host_env

if config_env() == :prod do
config :cms, CMS.Cache,
mode: :redis_cluster,
redis_cluster: [
configuration_endpoints: [
conn_opts: [
host: redis_host,
port: 6379
]
]
],
stats: false,
telemetry: false
else
config :cms, CMS.Cache,
conn_opts: [
host: redis_host,
port: 6379
],
stats: false,
telemetry: false
end

if config_env() == :test do
config :site, SiteWeb.Router,
Expand Down

0 comments on commit bf4c2d4

Please sign in to comment.