# Environment variables

The variables the `cmdop` program reads. Everything else is set in
[`machine.json`](https://docs.cmdop.ai/reference/config/machine-json.md) and [`ceiling.json`](https://docs.cmdop.ai/reference/config/ceiling-json.md).

**In short:** Installing without a terminal: `CMDOP_ACCEPT_AGREEMENT=<version>`. More detail in the logs:
`RUST_LOG=debug`.

## Terms of use

| Variable | Value | Meaning |
|---|---|---|
| `CMDOP_ACCEPT_AGREEMENT` | the terms version | Accepts the terms of use where no terminal can ask, for a scripted install. It must be the exact version the program names; another value is refused. Read by release builds only. |

## Startup policy for one run

Each overrides one key of `machine.json` for this run and never writes the file. An empty or
unknown value is an error, not a fall-back to the file.

| Variable | Values | Overrides |
|---|---|---|
| `CMDOP_DAEMON_AUTOSTART` | `true` \| `false` | `daemon.autostart` |
| `CMDOP_DAEMON_RESTART` | `on_failure` \| `never` | `daemon.restart` |
| `CMDOP_GUI_ENABLED` | `true` \| `false` | `gui.enabled` |
| `CMDOP_GUI_AUTOSTART` | `true` \| `false` | `gui.autostart` |
| `CMDOP_GUI_LAUNCH` | `when_daemon_ready` \| `login` \| `manual` | `gui.launch` |
| `CMDOP_SERVICE_SCOPE` | `user` \| `system` | `service.scope` |
| `CMDOP_SERVICE_MANAGER` | `auto` \| `launchd` \| `systemd` \| `windows` | `service.manager` |

`cmdop config show` names `environment` as the origin of each value set this way.

## Logs

| Variable | Value | Meaning |
|---|---|---|
| `RUST_LOG` | a filter, for example `debug` or `info` | How much the program logs. Default `info`. Logs go to standard error. |
| `CMDOP_LOG_FORMAT` | `json` | One JSON object per line instead of plain text. |

## What commands on the machine see

Commands that agents run start with a small base environment and the variables the call passes,
not with the `cmdop` program's own environment: [run commands](https://docs.cmdop.ai/guides/run.md#run-a-command-and-wait).
