diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-27 09:01:44 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-27 09:01:44 +0300 |
| commit | 626ff3ae7d43cfc2ec3f2554d340b40f4a5c0586 (patch) | |
| tree | 56840d4c9815de0a71a41bceac71136371978076 /internal | |
| parent | 30e63df03544b94ebc5fcb2a004d18a0d32a4247 (diff) | |
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/).
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/config/config.go | 11 |
1 files changed, 10 insertions, 1 deletions
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 } |
