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:
parent
080dac3813
commit
f8e075319e
1 changed files with 8 additions and 1 deletions
|
|
@ -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"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue