Atulin.InfisicalConfig 1.0.0

dotnet add package Atulin.InfisicalConfig --version 1.0.0
                    
NuGet\Install-Package Atulin.InfisicalConfig -Version 1.0.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="Atulin.InfisicalConfig" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Atulin.InfisicalConfig" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Atulin.InfisicalConfig" />
                    
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 Atulin.InfisicalConfig --version 1.0.0
                    
#r "nuget: Atulin.InfisicalConfig, 1.0.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 Atulin.InfisicalConfig@1.0.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=Atulin.InfisicalConfig&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Atulin.InfisicalConfig&version=1.0.0
                    
Install as a Cake Tool

Atulin.InfisicalConfig

A .NET configuration provider that fetches secrets from Infisical and injects them into IConfiguration at startup. Supports retries, AOT compilation, and native integration with the .NET host builder.

Installation

dotnet add package Atulin.InfisicalConfig

Quick start

Call AddInfisicalAsync on your IHostApplicationBuilder before building the host:

var builder = WebApplication.CreateBuilder(args);

await builder.AddInfisicalAsync();

var app = builder.Build();

Secrets are available through the standard IConfiguration interface from that point on, including via IOptions<T> binding.

Configuration

Connection details are read from your existing configuration (e.g. appsettings.json, user secrets, or environment variables) under the Infisical key by default:

{
  "Infisical": {
    "Url": "https://app.infisical.com",
    "ProjectId": "your-project-id",
    "MachineId": "your-machine-identity-client-id",
    "ClientSecret": "your-machine-identity-client-secret",
    "Env": "prod",
    "SecretPath": "/",
    "Prefix": "",
    "ExpandSecretReferences": true,
    "IncludeImports": true
  }
}
Field Required Default Description
Url Base URL of your Infisical instance
ProjectId Infisical project ID
MachineId Machine identity client ID
ClientSecret Machine identity client secret
Env dev Infisical environment slug
SecretPath / Path within the environment to fetch secrets from
Prefix (none) Prepended to every secret key (see Key mapping)
ExpandSecretReferences true Resolve secret references on the Infisical side
IncludeImports true Include imported secrets

Tip: In production, supply MachineId and ClientSecret via environment variables rather than appsettings.json to avoid committing credentials.

Binder options

Pass a delegate to AddInfisicalAsync to adjust retry and transport behaviour:

await builder.AddInfisicalAsync(cfg =>
{
    cfg.MaxRetries = 3;
    cfg.Prefix = "Infisical";

    cfg.OnRetry = (attempt, max, delay, ex) =>
        logger.LogWarning(ex, "Infisical unreachable ({Attempt}/{Max}), retrying in {Delay}s",
            attempt, max, delay.TotalSeconds);
});
Property Default Description
MaxRetries 5 Number of attempts before throwing. Uses exponential backoff starting at 2 s
Prefix "Infisical" Configuration section key to read connection options from
OnRetry null Callback invoked after each failed attempt (see below)
HttpMessageHandlerFactory null Factory for a custom HttpMessageHandler, e.g. for SSL or proxy configuration

Retry callback

OnRetry receives the attempt number, the configured maximum, the upcoming delay, and the exception:

cfg.OnRetry = (attempt, max, delay, ex) =>
    Console.Error.WriteLine($"[Infisical] Attempt {attempt}/{max} failed, retrying in {delay.TotalSeconds}s: {ex.Message}");

If OnRetry is null, transient failures are silently retried. Exhausting all attempts, or encountering a non-network error, throws immediately.

Custom HTTP handler

Use HttpMessageHandlerFactory to customise transport-level behaviour such as SSL certificates or proxies. The library takes ownership of each returned handler.

// Trust a self-signed certificate on a private Infisical instance
cfg.HttpMessageHandlerFactory = () => new HttpClientHandler
{
    ServerCertificateCustomValidationCallback = (_, cert, _, _) =>
        cert?.Thumbprint == "YOUR_CERT_THUMBPRINT";
};

Key mapping

Infisical secret keys are mapped to IConfiguration keys with two transformations applied:

  • Double underscores (__) are replaced with : to represent configuration hierarchy, matching the standard .NET convention for environment variables.
  • If Prefix is set in the Infisical options, it is prepended to every key.

Given Prefix = "MyApp", a secret named Database__ConnectionString becomes MyApp:Database:ConnectionString in IConfiguration, bindable as:

builder.Services.Configure<DatabaseOptions>(
    builder.Configuration.GetSection("MyApp:Database"));

AOT compatibility

The library is fully AOT and trim compatible. Add the following to your project to take advantage of the configuration binding source generator:

<PropertyGroup>
  <EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
</PropertyGroup>
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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 104 6/2/2026