diff --git a/backend/cmd/smartrund/main.go b/backend/cmd/smartrund/main.go index 1b4f82c..82cd61c 100644 --- a/backend/cmd/smartrund/main.go +++ b/backend/cmd/smartrund/main.go @@ -30,11 +30,16 @@ func main() { } defer db.Close() + profile, err := db.GetProfile(context.Background()) + if err != nil { + log.Fatalf("load profile: %v", err) + } + garminClient := garmin.NewClient(garmin.Config{ PythonPath: cfg.GarminPythonPath, ServerPath: cfg.GarminServerPath, - GarminEmail: cfg.GarminEmail, - GarminPassword: cfg.GarminPassword, + GarminEmail: profile.GarminEmail, + GarminPassword: profile.GarminPassword, TokenStorePath: cfg.GarminTokenStore, }) defer garminClient.Close() @@ -42,7 +47,6 @@ func main() { syncSvc := appsync.NewService(garminClient, db, appsync.Config{ BackfillHorizonDays: cfg.BackfillHorizonDays, MinConfidence: cfg.MinConfidence, - MaxHR: cfg.MaxHR, }, nil) server := api.NewServer(db, garminClient, syncSvc) diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go index 9339170..844c805 100644 --- a/backend/internal/config/config.go +++ b/backend/internal/config/config.go @@ -1,6 +1,8 @@ -// Package config loads smartrund's runtime configuration from environment -// variables (a single-user local app has no need for a config file/flags -// beyond this). +// Package config loads smartrund's runtime infrastructure configuration +// from environment variables (paths and process settings that don't belong +// in the user-editable profile). Garmin credentials and every tunable +// analysis-engine parameter live in the profile (internal/store.Profile) +// instead -- see docs/superpowers/specs/2026-07-17-profile-taxonomy-analysis-engine-design.md. package config import ( @@ -10,7 +12,7 @@ import ( "time" ) -// Config holds everything smartrund needs to start. +// Config holds smartrund's process-level configuration. type Config struct { // Addr is the HTTP listen address, e.g. ":8080". Addr string @@ -21,13 +23,10 @@ type Config struct { GarminPythonPath string // GarminServerPath is mcp-garmin's server.py. GarminServerPath string - GarminEmail string - GarminPassword string // GarminTokenStore, if set, overrides mcp-garmin's default ~/.garth // session cache location. GarminTokenStore string - MaxHR float64 MinConfidence float64 BackfillHorizonDays int IncrementalSyncEvery time.Duration @@ -41,10 +40,7 @@ func Load() (Config, error) { DBPath: getEnvDefault("SMARTRUN_DB_PATH", "smartrun.db"), GarminPythonPath: os.Getenv("MCP_GARMIN_PYTHON"), GarminServerPath: os.Getenv("MCP_GARMIN_SERVER"), - GarminEmail: os.Getenv("GARMIN_EMAIL"), - GarminPassword: os.Getenv("GARMIN_PASSWORD"), GarminTokenStore: os.Getenv("GARMIN_TOKENSTORE"), - MaxHR: getEnvFloat("SMARTRUN_MAX_HR", 190), MinConfidence: getEnvFloat("SMARTRUN_MIN_CONFIDENCE", 0.6), BackfillHorizonDays: getEnvInt("SMARTRUN_BACKFILL_HORIZON_DAYS", 3*365), IncrementalSyncEvery: getEnvDuration("SMARTRUN_INCREMENTAL_SYNC_EVERY", 6*time.Hour), @@ -56,9 +52,6 @@ func Load() (Config, error) { if cfg.GarminServerPath == "" { return cfg, fmt.Errorf("MCP_GARMIN_SERVER is required (path to mcp-garmin's server.py)") } - if cfg.GarminEmail == "" || cfg.GarminPassword == "" { - return cfg, fmt.Errorf("GARMIN_EMAIL and GARMIN_PASSWORD are required") - } return cfg, nil }