mirror of
https://github.com/go-task/task.git
synced 2025-11-25 22:32:55 +02:00
Allow vars in dotenv paths, including environment variables
Closes #453 Closes #434 Ref #433 Co-authored-by: Andrey Nering <andrey@nering.com.br>
This commit is contained in:
committed by
Andrey Nering
parent
cded9af90f
commit
08265ed1d7
17
task.go
17
task.go
@@ -176,6 +176,23 @@ func (e *Executor) Setup() error {
|
||||
}
|
||||
}
|
||||
|
||||
if v >= 3.0 {
|
||||
env, err := read.Dotenv(e.Compiler, e.Taskfile, e.Dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = env.Range(func(key string, value taskfile.Var) error {
|
||||
if _, ok := e.Taskfile.Env.Mapping[key]; !ok {
|
||||
e.Taskfile.Env.Set(key, value)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if v < 2.1 && e.Taskfile.Output != "" {
|
||||
return fmt.Errorf(`task: Taskfile option "output" is only available starting on Taskfile version v2.1`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user