Configuration
How are you running P2G?
Web UI Configuration
The most common settings can be configured via the UI itself. Additional lower level settings can be provided via config file.
- Settings
- Low Level Settings
Windows UI Configuration
The most common settings can be configured via the UI itself.
Config File
When using a flavor of P2G that does not provide a user interface, all settings are provided via a JSON config file.
P2G looks for a file named configuration.local.json
in the same directory where it is run to load its settings.
The structure of this file is as follows:
{
"App": { /**(1)!**/ },
"Format": { /**(2)!**/ },
"Peloton": { /**(3)!**/ },
"Garmin": { /**(4)!**/ },
"Observability": { /**(5)!**/ }
}
- Go to App Settings Documentation
- Go to Format Settings Documentation
- Go to Peloton Settings Documentation
- Go to Garmin Settings Documentation
- Go to Observability Settings Documentation
Tip
P2G provides an example config to get you started.
Additional Configuration Options
P2G supports configuration via
By default, P2G looks for a file named configuration.local.json
in the same directory where it is run.
Config Precedence
The following defines the precedence in which config definitions are honored. With the first items having higher precendence than the next items.
- Command Line
- Environment Variables
- Config File
For example, if you defined your Peloton credentials ONLY in the Config file, then the Config file credentials will be used.
If you defined your credentials in both the Config file AND the Environment variables, then the Environment variable credentials will be used.
If you defined credentials using all 3 methods (config file, env, and command line), then the credentials provided via the command line will be used.
Command Line Configuration
All of the values defined in the Json config file can also be defined as command line arguments. This functionality is provided by the default dotnet IConfiguration interface.
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"