docs: clarify dotenv file precedence when multiple files are specified (#2628)

This commit is contained in:
Bouke Versteegh
2026-01-14 19:37:41 +01:00
committed by GitHub
parent 179bde1f37
commit 3d4d189bcd
2 changed files with 18 additions and 3 deletions

View File

@@ -174,6 +174,19 @@ tasks:
- echo "Using $KEYNAME and endpoint $ENDPOINT"
```
When the same variable is defined in multiple dotenv files, the **first file in
the list takes precedence**. This allows you to set up override patterns by
placing higher-priority files first:
```yaml
version: '3'
dotenv:
- .env.local # Highest priority - local developer overrides
- .env.{{.ENV}} # Environment-specific settings
- .env # Base defaults (lowest priority)
```
Dotenv files can also be specified at the task level:
```yaml

View File

@@ -155,12 +155,14 @@ silent: true
### `dotenv`
- **Type**: `[]string`
- **Description**: Load environment variables from .env files
- **Description**: Load environment variables from .env files. When the same
variable is defined in multiple files, the first file in the list takes
precedence.
```yaml
dotenv:
- .env
- .env.local
- .env.local # Highest priority
- .env # Lowest priority
```
### `run`