From a11ff789e30e66b1d03cdc697eaadacd4a907129 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 24 Jan 2026 14:25:01 -0600 Subject: [PATCH] fix: add REDIS_PASSWORD support to runtime configuration Redis authentication was failing with "NOAUTH Authentication required" because the password wasn't being read from the environment variable. Changes: - Read REDIS_PASSWORD from environment in runtime.exs - Add password to :redis config keyword list if present - Phoenix.PubSub.Redis and Exq now read password from Application config The application.ex and exq_supervisor.ex already had password support from System.get_env("REDIS_PASSWORD"), but runtime.exs wasn't passing the password through to the :redis config, so it was never available to the application code. This enables connection to the new Proxmox-hosted Valkey instance at 10.0.15.21 with authentication. --- config/runtime.exs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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