Skip to content

Configuration

How are you running P2G?

  1. I'm using the Web UI
  2. I'm using the Windows GUI
  3. I'm using GitHub Actions
  4. I'm running Headless

Web UI Configuration

The most common settings can be configured via the UI itself. Additional lower level settings can be provided via config file.

  1. Settings
    1. App Settings
    2. Conversion Settings
    3. Peloton Settings
    4. Garmin Settings
  2. Low Level Settings
    1. Api Configuration
    2. Web UI Configuration

Windows UI Configuration

The most common settings can be configured via the UI itself.

  1. Settings
    1. App Settings
    2. Conversion Settings
    3. Peloton Settings
    4. Garmin Settings

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)!**/ }
}
  1. Go to App Settings Documentation
  2. Go to Format Settings Documentation
  3. Go to Peloton Settings Documentation
  4. Go to Garmin Settings Documentation
  5. Go to Observability Settings Documentation

Tip

P2G provides an example config to get you started.

Additional Configuration Options

P2G supports configuration via

  1. command line arguments
  2. environment variables
  3. json config file
  4. via the user interface

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.

  1. Command Line
  2. Environment Variables
  3. 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"