Skip to content

Environment Variable Configuration

All of the values defined in the Json config file can also be defined as environment variables. This functionality is provided by the default dotnet IConfiguration interface.

The variables use the following convention, note the use of both single and double underscores:

P2G_CONFIGSECTION__CONFIGPROPERTY=value

Example App Config

P2G_APP__WORKINGDIRECTORY
P2G_APP__ENABLEPOLLING
P2G_APP__POLLINGINTERVALSECONDS
P2G_APP__PYTHONANDGUPLOADINSTALLED

Example Arrays

P2G_PELOTON__EXCLUDEWORKOUTTYPES__0="meditation"
P2G_PELOTON__EXCLUDEWORKOUTTYPES__1="stretching"
P2G_PELOTON__EXCLUDEWORKOUTTYPES__2="yoga"
...and so on

Example Nested Sections

For nested config sections, continue to use the same naming convention of defining the entire json path using __ double underscores, and 0 based indexing for array values.

P2G_OBSERVABILITY__SERILOG__WRITETO__0__NAME="File"