Skip to content

Commit b4045af

Browse files
committed
Handled the case where env path is absolute
1 parent 9336afa commit b4045af

File tree

1 file changed

+6
-1
lines changed
  • internal/devconfig/configfile

1 file changed

+6
-1
lines changed

internal/devconfig/configfile/env.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ func (c *ConfigFile) ParseEnvsFromDotEnv() (map[string]string, error) {
2626
if !c.IsdotEnvEnabled() {
2727
return nil, fmt.Errorf("env file does not have a .env extension")
2828
}
29-
envFileAbsPath := path.Join(filepath.Dir(c.AbsRootPath), c.EnvFrom)
29+
envFileAbsPath := filepath.Dir(c.AbsRootPath)
30+
if filepath.IsAbs(c.EnvFrom) {
31+
envFileAbsPath = path.Join(envFileAbsPath, path.Base(c.EnvFrom))
32+
} else {
33+
envFileAbsPath = path.Join(envFileAbsPath, c.EnvFrom)
34+
}
3035
file, err := os.Open(envFileAbsPath)
3136
if err != nil {
3237
return nil, fmt.Errorf("failed to open file: %s", envFileAbsPath)

0 commit comments

Comments
 (0)