Provides easy access to environment variables with fallback.
More...
|
static string | String (string envVar, string fallback) |
| Returns the value of the named environment variable or the fallback if that variable is not set.
|
static int | Integer (string envVar, int fallback, int? min=null, int? max=null) |
| Tries to return an integer value set as an environment variable.
|
static decimal | Decimal (string envVar, decimal fallback, decimal? min=null, decimal? max=null) |
| Tries to return a decimal value set as an environment variable.
|
static bool | Flag (string envVar, bool fallback) |
| Tries to return a boolean value set as an environment variable.
|
Provides easy access to environment variables with fallback.
◆ Decimal()
decimal PeanutButter.Utils.Env.Decimal |
( |
string | envVar, |
|
|
decimal | fallback, |
|
|
decimal? | min = null, |
|
|
decimal? | max = null ) |
|
static |
Tries to return a decimal value set as an environment variable.
- if the variable is not set, returns the fallback
- if the variable value is not a decimal, throws
- before returning, validate it's within any specified range and, if not, will clip to be within that range
- Parameters
-
- Returns
◆ Flag()
bool PeanutButter.Utils.Env.Flag |
( |
string | envVar, |
|
|
bool | fallback ) |
|
static |
Tries to return a boolean value set as an environment variable.
- if the variable is not set, returns the fallback
- if the variable value is not a recognised boolean, throws
- truthy values: true, 1, yes, on
- falsy values: false, 0, no, off parsing is case-insensitive
- Parameters
-
- Returns
◆ Integer()
int PeanutButter.Utils.Env.Integer |
( |
string | envVar, |
|
|
int | fallback, |
|
|
int? | min = null, |
|
|
int? | max = null ) |
|
static |
Tries to return an integer value set as an environment variable.
- if the variable is not set, returns the fallback
- if the variable is not an integer, throws
- before returning, validate it's within any specified range and, if not, will clip to be within that range
- Parameters
-
- Returns
◆ String()
string PeanutButter.Utils.Env.String |
( |
string | envVar, |
|
|
string | fallback ) |
|
static |
Returns the value of the named environment variable or the fallback if that variable is not set.
- Parameters
-
- Returns
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/Env.cs