From 626ff3ae7d43cfc2ec3f2554d340b40f4a5c0586 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 27 Apr 2026 09:01:44 +0300 Subject: Externalize sync targets from hardcoded constants to env/config - Added SyncTargets and SyncRemoteDir to internal/config.Config. - Replaced the package-level syncTargets and syncRemoteDir constants in cmd/snonux/sync.go with default values, populated lazily via resolveSyncConfig(). - Accept --sync-targets and --sync-remote-dir CLI flags; fall back to SNONUX_SYNC_TARGETS and SNONUX_SYNC_REMOTE_DIR env vars; then fall back to the previous hardcoded defaults (pi0/pi1, /var/www/html/snonux/). --- internal/config/config.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'internal') diff --git a/internal/config/config.go b/internal/config/config.go index f52b445..f310a6f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -24,6 +24,15 @@ type Config struct { // Defaults to "neon". Run with --help to see all available themes. Theme string - // Sync, when true, rsyncs OutputDir to fixed mirror hosts after a successful run. + // Sync, when true, rsyncs OutputDir to mirror hosts after a successful run. Sync bool + + // SyncTargets are the remote hostnames to rsync to when Sync is true. + // Defaults to ["pi0.lan.buetow.org", "pi1.lan.buetow.org"]. + // Override with SNONUX_SYNC_TARGETS env var (comma-separated). + SyncTargets []string + + // SyncRemoteDir is the destination directory on each target host. + // Defaults to "/var/www/html/snonux/". Override with SNONUX_SYNC_REMOTE_DIR env var. + SyncRemoteDir string } -- cgit v1.2.3