mirror of
https://github.com/go-task/task.git
synced 2026-08-29 10:08:27 +02:00
71 lines
2.0 KiB
Markdown
71 lines
2.0 KiB
Markdown
|
|
---
|
||
|
|
title: Configuration Reference
|
||
|
|
description: Complete reference for the Task config files and env vars
|
||
|
|
permalink: /reference/config/
|
||
|
|
outline: deep
|
||
|
|
---
|
||
|
|
|
||
|
|
# Configuration Reference
|
||
|
|
|
||
|
|
Task has multiple ways of being configured. These methods are parsed, in
|
||
|
|
sequence, in the following order with the highest priority last:
|
||
|
|
|
||
|
|
- [Environment variables](./environment.md)
|
||
|
|
- _Configuration files_
|
||
|
|
- [Command-line flags](./cli.md)
|
||
|
|
|
||
|
|
In this document, we will look at the second of the three options, configuration
|
||
|
|
files.
|
||
|
|
|
||
|
|
## File Precedence
|
||
|
|
|
||
|
|
Task's configuration files are named `.taskrc.yml` or `.taskrc.yaml`. Task will
|
||
|
|
automatically look for directories containing files with these names in the
|
||
|
|
following order with the highest priority first:
|
||
|
|
|
||
|
|
- Current directory (or the one specified by the `--taskfile`/`--entrypoint`
|
||
|
|
flags).
|
||
|
|
- Each directory walking up the file tree from the current directory (or the one
|
||
|
|
specified by the `--taskfile`/`--entrypoint` flags) until we reach the user's
|
||
|
|
home directory or the root directory of that drive.
|
||
|
|
- `$XDG_CONFIG_HOME/task`.
|
||
|
|
|
||
|
|
All config files will be merged together into a unified config, starting with
|
||
|
|
the lowest priority file in `$XDG_CONFIG_HOME/task` with each subsequent file
|
||
|
|
overwriting the previous one if values are set.
|
||
|
|
|
||
|
|
For example, given the following files:
|
||
|
|
|
||
|
|
```yaml [$XDG_CONFIG_HOME/task/.taskrc.yml]
|
||
|
|
# lowest priority global config
|
||
|
|
option_1: foo
|
||
|
|
option_2: foo
|
||
|
|
option_3: foo
|
||
|
|
```
|
||
|
|
|
||
|
|
```yaml [$HOME/.taskrc.yml]
|
||
|
|
option_1: bar
|
||
|
|
option_2: bar
|
||
|
|
```
|
||
|
|
|
||
|
|
```yaml [$HOME/path/to/project/.taskrc.yml]
|
||
|
|
# highest priority project config
|
||
|
|
option_1: baz
|
||
|
|
```
|
||
|
|
|
||
|
|
You would end up with the following configuration:
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
option_1: baz # Taken from $HOME/path/to/project/.taskrc.yml
|
||
|
|
option_2: bar # Taken from $HOME/.taskrc.yml
|
||
|
|
option_3: foo # Taken from $XDG_CONFIG_HOME/task/.taskrc.yml
|
||
|
|
```
|
||
|
|
|
||
|
|
## Configuration Options
|
||
|
|
|
||
|
|
### `experiments`
|
||
|
|
|
||
|
|
The experiments section allows you to enable Task's experimental features. These
|
||
|
|
options are not enumerated here. Instead, please refer to our
|
||
|
|
[experiments documentation](../experiments/index.md) for more information.
|