Environment variables
To set environment variables go to PlutoFramework/appsettings.json
file (if the file does not exist, create it) and fill in the contents like this:
{
"VARIABLE_NAME_1": "value 1",
"VARIABLE_NAME_2": "value 2"
}
These environment variables are then loaded in PlutoFramework/MauiProgram.cs
in AddAppSettings
method.
You can then access the environment variable like this:
var configuration = MauiProgram.Services.GetService<IConfiguration>();
var value1 = configuration.GetValue<string>("VARIABLE_NAME_1");
Last updated