From fcff4fa6f03821034f678f0a4df5f2a96bf85a4e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 25 Feb 2026 16:23:22 -0600 Subject: [PATCH] Fix packet retention config to read env var at runtime Move packet_retention_days configuration from config.exs (compile-time) to runtime.exs so it properly reads the PACKET_RETENTION_DAYS environment variable at runtime instead of baking in the default value during build. This fixes the issue where the app was using 7 days retention despite PACKET_RETENTION_DAYS being set to 1 in the deployment, causing disk to fill up with 54GB of old partition data. --- config/config.exs | 2 -- config/runtime.exs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.exs b/config/config.exs index c90ad32..3e187d0 100644 --- a/config/config.exs +++ b/config/config.exs @@ -54,8 +54,6 @@ config :aprsme, aprs_is_password: System.get_env("APRS_PASSCODE"), auto_migrate: true, env: config_env(), - # Packet retention period in days (default: 7 days) - packet_retention_days: String.to_integer(System.get_env("PACKET_RETENTION_DAYS", "7")), # GenStage packet processing configuration # Optimized for PostgreSQL with work_mem=16MB and synchronous_commit=off packet_pipeline: [ diff --git a/config/runtime.exs b/config/runtime.exs index 8cf04e9..db7611a 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -144,6 +144,8 @@ if config_env() == :prod do 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_PASSWORD") || System.get_env("APRS_PASSCODE"), + # Packet retention period in days (default: 7 days) + packet_retention_days: String.to_integer(System.get_env("PACKET_RETENTION_DAYS") || "7"), env: :prod # Configure Hammer for production environment