Skip to content

Commit 4caf029

Browse files
committed
Updates
1 parent a32f026 commit 4caf029

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

docs/manage/reference/viam-agent/_index.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ For information on managing the service, see [Manage `viam-agent`](/manage/refer
102102
"viam_server_start_timeout_minutes": 10,
103103
"disable_viam_server": false,
104104
"disable_network_configuration": false,
105-
"disable_system_configuration": false
105+
"disable_system_configuration": false,
106+
"viam_server_env": {
107+
"CUSTOM_VAR": "value"
108+
}
106109
},
107110
"network_configuration": {
108111
"manufacturer": "viam",
@@ -205,9 +208,42 @@ To update the version of `viam-server` (or the RDK) update the machine settings.
205208
| `disable_network_configuration` | boolean | Optional | Disables the network and hotspot configuration, as well as the configuration of additional networks. Default: `false`. |
206209
| `disable_system_configuration` | boolean | Optional | Disables the system configuration. Default: `false`. |
207210
| `disable_viam_server` | boolean | Optional | Disable `viam-server` remotely. This option is often used by developers working on Viam agent or when manually running `viam-server`. Default: `false`. |
211+
| `viam_server_env` | object | Optional | A map of environment variable names to values that `viam-agent` passes to `viam-server` and its child processes (including modules). Both keys and values must be strings. See [Environment Variables for viam-server](#environment-variables-for-viam-server). Default: `{}` (empty). |
208212
| `viam_server_start_timeout_minutes` | integer | Optional | Specify a time after which, if `viam-server` hasn't successfully started, Viam agent will kill it and restart. Default: `10`. |
209213
| `wait_for_update_check` | boolean | Optional | If set to `true`, `viam-agent` will wait for a network connection and check for updates before starting `viam-server`. See [Reduce startup time](#reduce-startup-time). Default: `false`. |
210214

215+
### Environment Variables for viam-server
216+
217+
You can configure environment variables for `viam-server` using the `viam_server_env` setting in `advanced_settings`.
218+
Environment variables set through `viam_server_env` are passed to `viam-server` and all child processes it launches, including modules.
219+
`viam-server` also inherits existing environment variables from `viam-agent`, such as `HOME`, `PWD`, `TERM`, `PATH`.
220+
221+
{{< alert title="Important" color="note" >}}
222+
When you change environment variables in `viam_server_env`, `viam-agent` will automatically restart `viam-server` to apply these and any other changes made before saving.
223+
This restart will occur immediately if `viam-server` is in a maintenance window and not currently processing configuration changes.
224+
{{< /alert >}}
225+
226+
Changes to `viam_server_env` are the only changes that automatically trigger a `viam-server` restart. Changing other configuration options requires a manual restart unless you've also changed `viam_server_env`.
227+
228+
#### Example configurations
229+
230+
```json
231+
{
232+
"agent": {
233+
"advanced_settings": {
234+
"viam_server_env": {
235+
"PION_LOG_TRACE": "all", # Debug logging for WebRTC
236+
"HTTPS_PROXY": "socks5://proxy.example.com:1080", # SOCKS proxy
237+
"HTTP_PROXY": "socks5://proxy.example.com:1080",
238+
"CUSTOM_VAR": "value"
239+
}
240+
}
241+
}
242+
}
243+
```
244+
245+
To remove an environment variable, remove it from the `viam_server_env` object and save your configuration.
246+
211247
### Reduce startup time
212248

213249
You can set `wait_for_update_check` to `false` to bypass `viam-agent` waiting for a network connection to be established and checking for updates during initial startup.

0 commit comments

Comments
 (0)