-
-
Notifications
You must be signed in to change notification settings - Fork 763
fix: expand task-level dotenv in brackets #1627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| dotenv: ['.env'] | ||
| cmds: | ||
| - echo "$FOO" > dotenv.txt | ||
| - echo "{{.FOO}}" > dotenv-2.txt | ||
| - task: dotenv_called | ||
| vars: | ||
| FOO: "{{.FOO}}" | ||
|
|
||
| dotenv_called: | ||
| cmds: | ||
| - echo "$FOO" > dotenv-called.txt | ||
| - echo "{{.FOO}}" > dotenv-called-2.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this PR, this variable forwarding finally works. There's still room for improvement if the dotenv vars should be automatically propagated to any underlying task. But that could be handled separately.
|
This PR solves an issue I am running into (thank you @aminya)! For the maintainers: is there a plan or timeline for when this will be merged? Or is there another action required here before it can be considered ready? Thank you! |
|
can someone review and merge? |
|
I can confirm this issue: the Taskfile doesn't expand environment variables from the dotenv files that are specified at the task level. They do work when placed at the root level, but not within individual tasks. I’ve attempted multiple approaches in line with the Documentation | .env files, yet the variables still aren’t being expanded as expected. My Taskfile version: Context
# Database Configuration
DB_SCHEME=postgres
DB_USERNAME=postgres
DB_PASSWORD=Qk3doyOiZcNpDh9
DB_HOST=localhost
DB_PORT=5555
DB_DATABASE=postges
DB_SSL=disableWorking Setup (Root-Level
|
|
Currently, one way to reference a different environment file at the command level is to define a separate Taskfile pointing to the desired Current workaround
|
|
Is there any way to move this PR forward? |
|
I've had only 25% chance of merging contributions to go-task. The probability is low. |
Fixes #997
Task level dotenv didn't expand the variables referenced by
{{.var}}previously This fixes the issue. I added a test for it to prevent the bug from happening again.