Fix Exq Redis configuration for Kubernetes deployment
- Parse REDIS_URL environment variable in runtime.exs - Extract host, port, password, and database from Redis URL - Use same Redis configuration parsing as RedisCache module - Fixes CrashLoopBackOff caused by Exq trying to connect to localhost 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f6b0454d79
commit
269ec5a070
1 changed files with 31 additions and 0 deletions
|
|
@ -119,6 +119,37 @@ if config_env() == :prod do
|
|||
config :aprsme,
|
||||
default_from_email: "w5isp@aprs.me"
|
||||
|
||||
# Configure Exq with Redis connection from environment
|
||||
redis_url = System.get_env("REDIS_URL", "redis://localhost:6379")
|
||||
redis_uri = URI.parse(redis_url)
|
||||
|
||||
redis_host = redis_uri.host || "localhost"
|
||||
redis_port = redis_uri.port || 6379
|
||||
redis_password = case redis_uri.userinfo do
|
||||
nil -> ""
|
||||
userinfo ->
|
||||
case String.split(userinfo, ":") do
|
||||
[_, password] -> password
|
||||
_ -> ""
|
||||
end
|
||||
end
|
||||
|
||||
# Extract database from path if present
|
||||
redis_database = case redis_uri.path do
|
||||
nil -> 0
|
||||
"/" -> 0
|
||||
path ->
|
||||
path |> String.trim_leading("/") |> String.to_integer()
|
||||
rescue
|
||||
_ -> 0
|
||||
end
|
||||
|
||||
config :exq,
|
||||
host: redis_host,
|
||||
port: redis_port,
|
||||
password: redis_password,
|
||||
database: redis_database
|
||||
|
||||
config :aprsme,
|
||||
ecto_repos: [Aprsme.Repo],
|
||||
aprs_is_server: System.get_env("APRS_SERVER", "dallas.aprs2.net"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue