Add configuration-file support to the 'task' command

This commit is contained in:
Dustin J. Mitchell 2020-11-28 18:18:43 -05:00
parent 8af7ba286d
commit 0e926df578
6 changed files with 236 additions and 45 deletions

View file

@ -9,13 +9,26 @@ Note that the `task` interface does not match that of TaskWarrior.
### Configuration
Temporarily, configuration is by environment variables.
The directory containing the replica's task data is given by `TASK_DB`, defaulting to `/tmp/tasks`.
the origin of the sync server is given by `SYNC_SERVER_ORIGIN`, defaulting to `http://localhost:8080`.
The client ID to use with the sync server is givne by `SYNC_SERVER_CLIENT_ID` (with no default).
The `task` command will work out-of-the-box with no configuration file, using default values.
Configuration is read from `taskchampion.yaml` (or `taskchampion.toml` or `taskchmapion.json` if you prefer) in your config directory.
On Linux systems, that directory is `~/.config`.
On OS X, it's `~/Library/Preferences`.
On Windows, it's `AppData/Roaming` in your home directory.
The path can be overridden by setting `$TASKCHAMPION_CONFIG`.
Individual configuration parameters can be overridden by environemnt variables, converted to upper-case and prefixed with `TASKCHAMPION_`, e.g., `TASKCHAMPION_DATA_DIR`.
Nested configuration parameters cannot be overridden by environment variables.
The following configuration parameters are available:
* `data_dir` - path to a directory containing the replica's task data (which will be created if necessary).
Default: `taskchampion` in the local data directory
* `server_origin` - Origin of the taskchampion sync server, e.g., `https://taskchampion.example.com`
* `server_client_id` - Client ID to identify this replica to the sync server (a UUID)
## `taskchampion-sync-server`
Run `taskchampion-sync-server` to start the sync server.
It serves on port 8080 on all interfaces, using an in-memory database (meaning that all data is lost when the process exits).
Requests for previously-unknown clients are automatically added.
Requests for previously-unknown clients automatically create the client.