1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

feat: add task-level dotenv support (#904)

This commit is contained in:
Pete Davison
2022-12-06 00:25:16 +00:00
committed by GitHub
parent 9cf930454d
commit 99d7338c29
10 changed files with 155 additions and 0 deletions

1
testdata/dotenv_task/default/.env vendored Normal file
View File

@@ -0,0 +1 @@
FOO=foo

View File

@@ -0,0 +1 @@
*.txt

View File

@@ -0,0 +1,28 @@
version: '3'
env:
FOO: global
tasks:
dotenv:
dotenv: ['.env']
cmds:
- echo "$FOO" > dotenv.txt
dotenv-overridden-by-env:
dotenv: ['.env']
env:
FOO: overridden
cmds:
- echo "$FOO" > dotenv-overridden-by-env.txt
dotenv-with-var-name:
vars:
DOTENV: .env
dotenv: ['{{.DOTENV}}']
cmds:
- echo "$FOO" > dotenv-with-var-name.txt
no-dotenv:
cmds:
- echo "$FOO" > no-dotenv.txt