Move backfill horizon from a startup env var into the editable profile
SMARTRUN_BACKFILL_HORIZON_DAYS was a server-startup-only env var with no UI, defaulting to 3 years -- so editing the unrelated "Rolling window" profile field (for classification, not sync) had no effect on how far back Sync Now reached. Backfill horizon is now Profile.BackfillHorizonDays, read fresh on every Backfill call, with its own field on the Profile page.
This commit is contained in:
@@ -28,7 +28,6 @@ type Config struct {
|
||||
GarminTokenStore string
|
||||
|
||||
MinConfidence float64
|
||||
BackfillHorizonDays int
|
||||
IncrementalSyncEvery time.Duration
|
||||
}
|
||||
|
||||
@@ -42,7 +41,6 @@ func Load() (Config, error) {
|
||||
GarminServerPath: os.Getenv("MCP_GARMIN_SERVER"),
|
||||
GarminTokenStore: os.Getenv("GARMIN_TOKENSTORE"),
|
||||
MinConfidence: getEnvFloat("SMARTRUN_MIN_CONFIDENCE", 0.6),
|
||||
BackfillHorizonDays: getEnvInt("SMARTRUN_BACKFILL_HORIZON_DAYS", 3*365),
|
||||
IncrementalSyncEvery: getEnvDuration("SMARTRUN_INCREMENTAL_SYNC_EVERY", 6*time.Hour),
|
||||
}
|
||||
|
||||
@@ -71,15 +69,6 @@ func getEnvFloat(key string, def float64) float64 {
|
||||
return def
|
||||
}
|
||||
|
||||
func getEnvInt(key string, def int) int {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
if n, err := strconv.Atoi(v); err == nil {
|
||||
return n
|
||||
}
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
func getEnvDuration(key string, def time.Duration) time.Duration {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
if d, err := time.ParseDuration(v); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user