fix(config): stop deriving GarminTokenStoreRoot's default from DBPath
There's no reason the Garmin token-store root and the SQLite database
file need to live near each other -- they're independent env vars
(GARMIN_TOKENSTORE, GENIUSRUN_DB_PATH) and should stay independently
configurable, including in their defaults. Revert the "next to DBPath"
default introduced in 77f9588 back to a plain ".garmin" relative to
the working directory, so pointing GENIUSRUN_DB_PATH elsewhere never
silently drags the token-store default along with it.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -79,7 +78,7 @@ func TestLoad_SessionSecretTooShort(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoad_GarminTokenStoreRootDefaultsNextToDBPath(t *testing.T) {
|
||||
func TestLoad_GarminTokenStoreRootDefaultsIndependentlyOfDBPath(t *testing.T) {
|
||||
setRequiredEnv(t)
|
||||
t.Setenv("GARMIN_TOKENSTORE", "")
|
||||
t.Setenv("GENIUSRUN_DB_PATH", "/var/lib/geniusrun/geniusrun.db")
|
||||
@@ -88,9 +87,8 @@ func TestLoad_GarminTokenStoreRootDefaultsNextToDBPath(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Load: %v", err)
|
||||
}
|
||||
want := filepath.Join("/var/lib/geniusrun", ".garmin")
|
||||
if cfg.GarminTokenStoreRoot != want {
|
||||
t.Errorf("GarminTokenStoreRoot = %q, want %q", cfg.GarminTokenStoreRoot, want)
|
||||
if cfg.GarminTokenStoreRoot != ".garmin" {
|
||||
t.Errorf("GarminTokenStoreRoot = %q, want %q (never derived from DBPath's directory)", cfg.GarminTokenStoreRoot, ".garmin")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user