Environment variables for the relay

Configure upstream URLs, Redis DSN, TTL seconds, and log levels without editing Python source on the server.

Relays read configuration from the environment at startup: where the Arduino lives, how long to cache JSON, which Redis DB index to use, and how verbose logging should be. Hard-coding LAN IPs in source leads to git leaks and rebuilds for trivial changes—environment variables align with Docker deployment and production hygiene.

Env file keys flowing into relay process configuration blocks
Environment variables supply upstream URL, Redis DSN, TTL, and log level at container start.

Common variables


        UPSTREAM_URL=http://192.168.1.50/
REDIS_URL=redis://redis:6379/0
CACHE_TTL_SECONDS=60
LOG_LEVEL=info
      

Secrets handling

Optional API keys for public relay auth belong in env—not committed files. Mirror patterns from Cloudflare secrets on the Astro side. Never store Supabase service keys in the relay unless it writes history directly.

Validation on boot

Fail fast when UPSTREAM_URL is missing; log resolved values once at INFO. Pair with health checks so orchestrators restart unhealthy containers instead of serving blank JSON.