feat(config)!: Rename CONFIG_DIR env var to LAZYDOCKER_CONFIG_DIR

This commit is contained in:
bytemaster.dev 2026-05-22 10:30:47 +02:00
parent 7e7aadc207
commit bd16fbe63c
2 changed files with 14 additions and 1 deletions

View file

@ -525,7 +525,7 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
}
func configDirForVendor(vendor string, projectName string) string {
envConfigDir := os.Getenv("CONFIG_DIR")
envConfigDir := os.Getenv("LAZYDOCKER_CONFIG_DIR")
if envConfigDir != "" {
return envConfigDir
}

View file

@ -49,6 +49,19 @@ func TestDockerComposeCommandMultipleFiles(t *testing.T) {
}
}
func TestConfigDirUsesLazydockerConfigDir(t *testing.T) {
expected := t.TempDir()
legacy := t.TempDir()
t.Setenv("LAZYDOCKER_CONFIG_DIR", expected)
t.Setenv("CONFIG_DIR", legacy)
actual := configDir("lazydocker")
if actual != expected {
t.Fatalf("Expected %s but got %s", expected, actual)
}
}
func TestWritingToConfigFile(t *testing.T) {
// init the AppConfig
emptyComposeFiles := []string{}