cli: support absolute paths in --envfile

GITHUB_PR_NUMBER: 5768
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/5768
closes https://github.com/hasura/graphql-engine/issues/5689

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2545
Co-authored-by: cybai <6782666+CYBAI@users.noreply.github.com>
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 38eacaaa5541a7162b584f1df1376266853fe4bf
This commit is contained in:
hasura-bot 2021-10-08 20:13:51 +05:30
parent bcb0b99f8b
commit 744cf0233e
2 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@ suffix-less versions. Aliases may be set by both
- server: support MSSQL insert mutations
- console: fix v2 metadata imports
- cli: make `--database-name` optional in `migrate` subcommands when using a single database (#7434)
- cli: support absolute paths in --envfile (#5689)
## v2.1.0-beta.1

View File

@ -962,7 +962,10 @@ func (ec *ExecutionContext) Spin(message string) {
// loadEnvfile loads .env file
func (ec *ExecutionContext) loadEnvfile() error {
envfile := filepath.Join(ec.ExecutionDirectory, ec.Envfile)
envfile := ec.Envfile
if !filepath.IsAbs(ec.Envfile) {
envfile = filepath.Join(ec.ExecutionDirectory, ec.Envfile)
}
err := gotenv.Load(envfile)
if err != nil {
// return error if user provided envfile name