Skip to content

Precedence of environment variables not respected in v3.20.0 #993

@blakewatters

Description

@blakewatters

I suspect that this is related to the newly merge task level dotenv support.

What I am seeing that environment variables specified explicitly at the task level no longer take precedence over ones defined by dotenv. For example, given a Taskfile of the form:

# dotenv file exports a `DATABASE_NAME` env var
dotenv: ['.env', '{{.HOME}}/.adapt.env']

task generate:config:
  env:
    DATABASE_NAME: "whatever"
  cmds:
    - echo "${DATABASE_NAME}"

You will always get the value of DATABASE_NAME defined by dotenv rather than the override defined at the local task level

  • Task version: v3.20.0
  • Operating System: macOS Ventura

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions