From 5aeec4f55e211bb45636c7f54cf0c3ce66f05f76 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 1 Apr 2026 16:07:17 -0500 Subject: [PATCH] Make HRRR base URL configurable, default to skippy proxy in dev --- config/dev.exs | 3 +++ lib/microwaveprop/weather/hrrr_client.ex | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/dev.exs b/config/dev.exs index 0bf69a28..fd070130 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -95,6 +95,9 @@ config :microwaveprop, srtm_tiles_dir: Path.expand("~/srtm/tiles") # Cache raw HRRR GRIB2 files locally (dev only — do not delete) config :microwaveprop, hrrr_cache_dir: Path.expand("~/hrrr") +# Proxy HRRR downloads through local caching nginx (set to nil to use S3 directly) +config :microwaveprop, hrrr_base_url: "http://skippy:8080" + # Freshness monitor watches for stale propagation scores config :microwaveprop, start_freshness_monitor: true diff --git a/lib/microwaveprop/weather/hrrr_client.ex b/lib/microwaveprop/weather/hrrr_client.ex index 606e065e..50d7416c 100644 --- a/lib/microwaveprop/weather/hrrr_client.ex +++ b/lib/microwaveprop/weather/hrrr_client.ex @@ -7,7 +7,9 @@ defmodule Microwaveprop.Weather.HrrrClient do require Logger - @hrrr_base "https://noaa-hrrr-bdp-pds.s3.amazonaws.com" + @hrrr_base_default "https://noaa-hrrr-bdp-pds.s3.amazonaws.com" + + defp hrrr_base, do: Application.get_env(:microwaveprop, :hrrr_base_url, @hrrr_base_default) # Fine-grained levels below 900mb (~1km) for duct detection, plus standard upper levels. # Every 25mb from 1000-900 for ~80m vertical spacing near surface. @@ -110,7 +112,7 @@ defmodule Microwaveprop.Weather.HrrrClient do :pressure -> "hrrr.t#{hour_str}z.wrfprsf#{fh_str}.grib2" end - "#{@hrrr_base}/hrrr.#{date_str}/conus/#{file}" + "#{hrrr_base()}/hrrr.#{date_str}/conus/#{file}" end def parse_idx(text) do