A .env file in the working directory is now optional

This commit is contained in:
bwilliams committed 2026-10-21 15:28:52 +01:00
1 parent 0b1952bd69
commit 1e3acaeff3
5 files changed
+30 -9

No files matched your search

+12 -2
View File
@@ -141,9 +141,19 @@ func TestInitKeepsCommandLineLevel(t *testing.T) {
}
}
// A .env file is optional.
func TestInitWithoutEnvFile(t *testing.T) {
initDir(t, nil, testConfigYAML)
var conf JobSearchConfig
if err := Init("", &conf); err != nil {
t.Fatalf("err = %v; want nil without a .env file", err)
}
}
func TestInitErrors(t *testing.T) {
t.Run("no .env file", func(t *testing.T) {
initDir(t, nil, testConfigYAML)
t.Run("invalid .env file", func(t *testing.T) {
dir := initDir(t, nil, testConfigYAML)
writeFile(t, filepath.Join(dir, ".env"), "NOT VALID\n")
var conf JobSearchConfig
if err := Init("", &conf); err == nil ||
!strings.Contains(err.Error(), ".env") {