diff --git a/config/runtime.exs b/config/runtime.exs index 1f32b9ac..f78230aa 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -49,6 +49,19 @@ if config_env() == :prod do # Configure Redis/Valkey connection redis_host = System.get_env("REDIS_HOST") || "localhost" redis_port = String.to_integer(System.get_env("REDIS_PORT") || "6379") + redis_password = System.get_env("REDIS_PASSWORD") + + redis_config = [ + host: redis_host, + port: redis_port + ] + + redis_config = + if redis_password do + Keyword.put(redis_config, :password, redis_password) + else + redis_config + end config :libcluster, topologies: [ @@ -153,8 +166,5 @@ if config_env() == :prod do # Set default sender for all emails config :towerops, :mailer_from, {"Towerops", "hi@towerops.net"} - - config :towerops, :redis, - host: redis_host, - port: redis_port + config :towerops, :redis, redis_config end