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.
This commit is contained in:
parent
0d4c8eb15a
commit
a11ff789e3
1 changed files with 14 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue