fix(aprs): handle empty APRS_DATABASE_URL and dedupe boot warning

- Empty-string env var (k8s secret resolves to '') was passing the nil
  check and handing Postgrex an empty URL — now treated the same as unset.
- Drop runtime.exs warning; keep the single warning in application.ex
  where the supervisor decision is made.
This commit is contained in:
Graham McIntire 2026-05-01 12:29:16 -05:00
parent 714d1ce432
commit 1312d84bb2
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -359,20 +359,18 @@ if config_env() == :prod do
# Optional secondary repo for read-only access to aprs.me's database.
# Used by APRS-based 144 MHz calibration tooling. When the env var is
# unset we leave the AprsRepo unconfigured; Microwaveprop.Application
# logs a warning and skips starting it, and the rest of the app boots
# normally.
# unset OR an empty string (k8s secret resolves to "") we leave the
# AprsRepo unconfigured; Microwaveprop.Application is the single site
# that logs the skip and decides not to start it.
case System.get_env("APRS_DATABASE_URL") do
nil ->
Logger.warning("APRS_DATABASE_URL not set — Microwaveprop.AprsRepo will not start; APRS calibration disabled.")
:ok
aprs_url ->
url when is_binary(url) and url != "" ->
config :microwaveprop, Microwaveprop.AprsRepo,
url: aprs_url,
url: url,
pool_size: String.to_integer(System.get_env("APRS_POOL_SIZE") || "2"),
socket_options: maybe_ipv6
_ ->
:ok
end
config :microwaveprop, MicrowavepropWeb.Endpoint,