Skip to content

Commit cbf49a0

Browse files
committed
Allowing absolute path for env_from
1 parent 24caaf8 commit cbf49a0

File tree

1 file changed

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

1 file changed

+3
-5
lines changed

internal/devconfig/configfile/env.go

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

98
"github.com/hashicorp/go-envparse"
@@ -26,11 +25,10 @@ func (c *ConfigFile) ParseEnvsFromDotEnv() (map[string]string, error) {
2625
if !c.IsdotEnvEnabled() {
2726
return nil, fmt.Errorf("env file does not have a .env extension")
2827
}
29-
// We don't allow absolute path for env_from as it breaks reproducibility
30-
if filepath.IsAbs(c.EnvFrom) {
31-
return nil, fmt.Errorf("`env_from` field can't take an absolute path")
28+
envFileAbsPath := c.EnvFrom
29+
if !filepath.IsAbs(c.EnvFrom) {
30+
envFileAbsPath = filepath.Join(filepath.Dir(c.AbsRootPath), c.EnvFrom)
3231
}
33-
envFileAbsPath := path.Join(filepath.Dir(c.AbsRootPath), c.EnvFrom)
3432
file, err := os.Open(envFileAbsPath)
3533
if err != nil {
3634
return nil, fmt.Errorf("failed to open file: %s", envFileAbsPath)

0 commit comments

Comments
 (0)