| 1 |
# Environment Variable Provider |
| 2 |
|
| 3 |
<!-- status autogenerated section --> |
| 4 |
| Status | | |
| 5 |
| ------------- |-----------| |
| 6 |
| Stability | [stable] | |
| 7 |
| Distributions | [core], [contrib], [k8s], [otlp] | |
| 8 |
| Issues | [](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aopen+is%3Aissue+label%3Aprovider%2Fenvprovider) [](https://github.com/open-telemetry/opentelemetry-collector/issues?q=is%3Aclosed+is%3Aissue+label%3Aprovider%2Fenvprovider) | |
| 9 |
|
| 10 |
[stable]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#stable |
| 11 |
[core]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol |
| 12 |
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib |
| 13 |
[k8s]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-k8s |
| 14 |
[otlp]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-otlp |
| 15 |
<!-- end autogenerated section --> |
| 16 |
|
| 17 |
## Usage |
| 18 |
|
| 19 |
The scheme for this provider is `env`. Usage looks like the following: |
| 20 |
|
| 21 |
```text |
| 22 |
env:NAME_OF_ENVIRONMENT_VARIABLE |
| 23 |
``` |
| 24 |
|
| 25 |
To use default values when the environment variable has not been set, you can |
| 26 |
include a suffix to specify it: |
| 27 |
|
| 28 |
```text |
| 29 |
env:NAME_OF_ENVIRONMENT_VARIABLE:-default_value |
| 30 |
``` |
| 31 |
|
| 32 |
Environment variables must match the following regular expression. That is, they |
| 33 |
must be at least one character, start with a letter or underscore, and can only |
| 34 |
include letters, numbers, and underscores. |
| 35 |
|
| 36 |
```text |
| 37 |
^[a-zA-Z_][a-zA-Z0-9_]*$ |
| 38 |
``` |