Skip to content

Commit

Permalink
Update .env file on init always
Browse files Browse the repository at this point in the history
Fix: #180

Current check it very unexpected and will cause more problems in the
future.

Signed-off-by: Maxim Sukharev <[email protected]>
  • Loading branch information
smacker committed Aug 1, 2019
1 parent 912decc commit b77ffb9
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions cmd/sourced/compose/workdir/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,17 +343,10 @@ func initWorkdir(workdirPath string, envFile envFile) error {
}

envPath := filepath.Join(workdirPath, ".env")
emptyFile, err := isEmptyFile(envPath)
contents := envFile.String()
err = ioutil.WriteFile(envPath, []byte(contents), 0644)
if err != nil {
return errors.Wrap(err, "could not read .env file contents")
}

if emptyFile {
contents := envFile.String()
err = ioutil.WriteFile(envPath, []byte(contents), 0644)
if err != nil {
return errors.Wrap(err, "could not write .env file")
}
return errors.Wrap(err, "could not write .env file")
}

return nil
Expand Down

0 comments on commit b77ffb9

Please sign in to comment.