You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm assuming that the issue is due to the order of evaluation at startup.
The following dotenv directive, does not source in the local .env, when the Taskfile.yaml resides in a parent directory (no local Taskfile.yaml), and using the {{.USER_WORKING_DIR}} in the path to the .env file.
dotenv:
- "{{.USER_WORKING_DIR}}/.env"
I'm trying to use a parent directory Taskfile.yaml for multiple environments:
The use case is to cd into any one of the env* directories, then run task X:
>cd env1
>task mytask
Where env1/.env contents are something like:
DOTENV_VAR="env1 specific value"
and where env2/.env contents are something like:
DOTENV_VAR="env2 specific value"
etc.
# Taskfile.yaml:
---
version: "3"
dotenv:
- "env1/.env" # works, but static, need to evaluate based on dir from which `task` command was run (child env1,2,3 dir).
# - "<full_dir_path_to_env1>/.env" # works
# Options below, DO NOT WORK
# - "{{.USER_WORKING_DIR}}/.env" # does NOT work
tasks:
mytask:
dir: "{{.USER_WORKING_DIR}}"
env:
DEV: '{{.DOTENV_VAR}}'
cmds:
- echo "my local env DOTENV_VAR = $DEV"
...
The trick I'm using to get around this for now is that from #1008 (comment) :
tasks:
mytask:
dir: "{{.USER_WORKING_DIR}}"
cmds:
- |
dotenv -f "{{.USER_WORKING_DIR}}/.env" run -- bash -c \
'echo "getting the dotenv the hard way, LOCAL_DOTENV_VAR = [$DOTENV_VAR]"'
I'm assuming that the issue is due to the order of evaluation at startup.
The following
dotenv
directive, does not source in the local.env
, when theTaskfile.yaml
resides in a parent directory (no localTaskfile.yaml
), and using the{{.USER_WORKING_DIR}}
in the path to the.env
file.I'm trying to use a parent directory Taskfile.yaml for multiple environments:
The use case is to cd into any one of the
env*
directories, then runtask X
:Where
env1/.env
contents are something like:and where
env2/.env
contents are something like:etc.
The trick I'm using to get around this for now is that from #1008 (comment) :
OR
The text was updated successfully, but these errors were encountered: