Skip to content

Commit 9336afa

Browse files
committed
Fixed env_from bug when it is called from a subdirectory
1 parent 1ec15d9 commit 9336afa

File tree

1 file changed

+4
-3
lines changed
  • internal/devconfig/configfile

1 file changed

+4
-3
lines changed

internal/devconfig/configfile/env.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package configfile
33
import (
44
"fmt"
55
"os"
6+
"path"
67
"path/filepath"
78

89
"github.com/hashicorp/go-envparse"
@@ -25,10 +26,10 @@ func (c *ConfigFile) ParseEnvsFromDotEnv() (map[string]string, error) {
2526
if !c.IsdotEnvEnabled() {
2627
return nil, fmt.Errorf("env file does not have a .env extension")
2728
}
28-
29-
file, err := os.Open(c.EnvFrom)
29+
envFileAbsPath := path.Join(filepath.Dir(c.AbsRootPath), c.EnvFrom)
30+
file, err := os.Open(envFileAbsPath)
3031
if err != nil {
31-
return nil, fmt.Errorf("failed to open file: %s", c.EnvFrom)
32+
return nil, fmt.Errorf("failed to open file: %s", envFileAbsPath)
3233
}
3334
defer file.Close()
3435

0 commit comments

Comments
 (0)