DontPanicLabs.Ifx.Configuration.Local 2.1.0

Prefix Reserved
dotnet add package DontPanicLabs.Ifx.Configuration.Local --version 2.1.0
                    
NuGet\Install-Package DontPanicLabs.Ifx.Configuration.Local -Version 2.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DontPanicLabs.Ifx.Configuration.Local" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DontPanicLabs.Ifx.Configuration.Local" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="DontPanicLabs.Ifx.Configuration.Local" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DontPanicLabs.Ifx.Configuration.Local --version 2.1.0
                    
#r "nuget: DontPanicLabs.Ifx.Configuration.Local, 2.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DontPanicLabs.Ifx.Configuration.Local@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DontPanicLabs.Ifx.Configuration.Local&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=DontPanicLabs.Ifx.Configuration.Local&version=2.1.0
                    
Install as a Cake Tool

Local Configuration

This project supports four configuration sources:

  • The appsettings.json file
  • The appsettings.{env}.json file
  • The .NET User Secrets store
  • Environment variables

appsettings.json

First the Config class loads the appsettings.json file, if included in the project. Values from appsettings.json will be overriden by values loaded from appsettings.{env}.json, user secrets and environment variables.

appsettings.json should never contain sensitive keys or secrets, as this file is checked into source control.

appsettings.{env}.json

Next the Config class tries to get the DOTNET_ENVIRONMENT or the ASPNETCORE_ENVIRONMENT variable, in that respective order, and adds the appsettings.{env}.json if it exists. Values from appsettings.{env}.json will be overriden by values loaded from user secrets and environment variables.

appsettings.{env}.json should also never contain sensitive keys or secrets, as this file is checked into source control.

User Secrets

The recommended method for managing configuration in a development environment is to use User Secrets: https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-8.0&tabs=windows.

User secrets are stored outside of the project directory, so they are not checked into source control. The Config class will load user secrets after loading appsettings.json and the appsettings.{env}.json files.

In order to load user secrets, you must specify the secrets file name in the ifx section of the config:

{
  "appSettings": { },
  "ifx": { 
    "userSecretsId": "dpl.ifx.configuration.tests" 
  }
}

The user secrets file name is specified in the project file.

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <UserSecretsId>dpl.ifx.configuration.tests</UserSecretsId>
</PropertyGroup>

Environment Variables

The Config class checks the appsettings.json file for the presence of the skipEnvironmentVariables entry. If this entry is found, and it is set to true, environment variables will not be loaded. Otherwise, environment variables will be loaded last, and will override any values loaded from the other configuration sources.

{
    "skipEnvironmentVariables": true,
    "ifx": {},
    "appsettings": {}
}

This setting is primarily intended to ensure consistent environment configuration for testing purposes.

Configuration Sections

ifx

The ifx section is intended for infrastructure items that do not directly relate to business operation of the application. Items such as connection strings, service endpoints, secret keys, etc.

appsettings

The appsettings section is intended for configuration items that affect the operation of the business/domain logic of the application. Items such as feature flags, business rules, etc.

Configuration Exceptions

When the config initializes, it requires the presence of the ifx and appsettings sections. If either of these sections are missing, the config will throw an exception.

Due to how the .NET configuration libraries work, the following will not result in a valid config file:

{
    "ifx": { },
    "appsettings": { }
}

The ifx and appsettings sections must contain at least one key-value pair. This will prevent the config from throwing an exception if no configuration has been specified for the application:

{
    "ifx": { 
        "_": "" 
    },
    "appsettings": { 
        "_": "" 
    }
}

Development Setup

In a development setting, the following is the recommended approach to managing configuration:

appsettings.json

{
    "ifx": {
        "userSecretsId": "location.specified.in.project.file"
    }
}

location.specified.in.project.file/secrets.json

{
    "ifx": {
        "Secret": "secret_value",
    },
    "appSettings": {
        "Application_Setting": "value",
        "Add more setting": "add some more"
    }
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on DontPanicLabs.Ifx.Configuration.Local:

Package Downloads
DontPanicLabs.Ifx.Proxy.Contracts

Base Proxy Contracts

DontPanicLabs.Ifx.Telemetry.Logger.Azure.ApplicationInsights

Logger Implementation for Azure Application Insights

DontPanicLabs.Ifx.Telemetry.Logger.Serilog

Logger Implementation for Serilog

DontPanicLabs.Ifx.Telemetry.Logger.Azure.OpenTelemetry

Logger Implementation for Azure Open Telemetry

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 1,493 1/13/2026
2.0.0 1,672 12/12/2025
1.0.1 7,928 6/24/2025
1.0.0 6,830 1/2/2025
0.5.1-preview 189 11/14/2024
0.5.0-preview 161 11/12/2024