Configuration
Where div reads its API key, API URL and project from, and in what order.
div reads three settings: the API key, the API URL and the project. For each setting, the first source that has a value wins.
Precedence
| Order | Source | API key | API URL | Project |
|---|---|---|---|---|
| 1 | Flags | --token |
--api-url |
--project |
| 2 | Environment | DIVERGENT_API_KEY, then DIVERGENT_TOKEN |
DIVERGENT_API_URL |
DIVERGENT_PROJECT |
| 3 | divergent.json |
api_url |
project |
|
| 4 | Settings file | token |
api_url |
project |
| 5 | Default | none | https://api.divergentlabs.xyz |
the current directory’s name |
An environment variable set to an empty string counts as unset. Without an API key, every command except div login, div catalog, div papers, div dashboard and div upgrade exits 2 and tells you to run div login.
Run div whoami to see which key and URL are in use and where the key came from.
divergent.json
A project file in the current directory or the nearest parent directory. It holds nothing secret, so you can commit it.
{ "project": "very-cool-classifier", "volume": "contracts-v3" }
| Field | Description | Default |
|---|---|---|
project |
Project for runs started from this directory. | the directory name |
volume |
Volume div run uploads code to. |
<project>-code |
api_url |
API URL. | https://api.divergentlabs.xyz |
Settings file
~/.config/divergent/config.json, or $XDG_CONFIG_HOME/divergent/config.json if XDG_CONFIG_HOME is set. div login writes it and makes it readable only by you.
{
"token": "dv_live_…"
}
api_url is present only if you signed in with div login --api-url. A file that is not valid JSON is ignored.
Other environment variables
| Variable | Description |
|---|---|
DIVERGENT_NO_UPDATE_CHECK=1 |
Turn off the daily check for a newer div. See div upgrade. |
XDG_CONFIG_HOME |
Base directory for the settings file. |
Project names
Project names are normalized: lowercased, with each run of characters other than letters and digits replaced by one hyphen, and cut to 63 characters. My Classifier (v2) becomes my-classifier-v2. A name with no letters or digits is rejected.
A project is created the first time you start a run in it.