Fix APRS_PORT parsing error causing application crashes

- Add robust integer parsing for APRS_PORT environment variable
- Fallback to default port 14580 if parsing fails
- Prevents crashes when environment variables contain unexpected values

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Graham McIntire 2025-07-27 13:45:56 -05:00
parent 080dac3813
commit f8e075319e
No known key found for this signature in database

View file

@ -172,7 +172,14 @@ if config_env() == :prod do
ecto_repos: [Aprsme.Repo],
aprs_is_server: System.get_env("APRS_SERVER", "dallas.aprs2.net"),
# config :aprsme, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
aprs_is_port: String.to_integer(System.get_env("APRS_PORT", "14580")),
aprs_is_port: case System.get_env("APRS_PORT", "14580") do
port when is_binary(port) ->
case Integer.parse(port) do
{int, ""} -> int
_ -> 14580 # fallback to default port if parsing fails
end
_ -> 14580
end,
aprs_is_default_filter: System.get_env("APRS_FILTER"),
aprs_is_login_id: System.get_env("APRS_CALLSIGN"),
aprs_is_password: System.get_env("APRS_PASSCODE"),