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.
This commit is contained in:
Graham McIntire 2026-02-25 16:23:22 -06:00
parent d385d1eb75
commit fcff4fa6f0
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -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: [

View file

@ -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