From f8e075319e7a47f4e00bdaa59684eaf3bfc59b0b Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sun, 27 Jul 2025 13:45:56 -0500 Subject: [PATCH] Fix APRS_PORT parsing error causing application crashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- config/runtime.exs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/runtime.exs b/config/runtime.exs index 3f054bc..8a1db26 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -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"),