KonfigMap 2.0.40

dotnet tool install --global KonfigMap --version 2.0.40
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local KonfigMap --version 2.0.40
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=KonfigMap&version=2.0.40
                    
nuke :add-package KonfigMap --version 2.0.40
                    

KonfigMap

v2 contains breaking changes from v1. The CLI command structure, option names, default output filename, and target framework have changed. If upgrading from v1, please review the updated usage below.

KonfigMap is a .NET global tool that generates Kubernetes ConfigMap-compatible .properties files from ASP.NET Core JSON configuration files. It bridges ASP.NET Core's hierarchical JSON configuration and Kubernetes ConfigMaps / Kustomize configMapGenerator.

Installation

Install as a .NET Global Tool

dotnet tool install --global KonfigMap

Note: Requires .NET 10 SDK or later.

Verify Installation

konfigmap --version

Update

dotnet tool update --global KonfigMap

Uninstall

dotnet tool uninstall --global KonfigMap

Quick Start

# Simplest usage — point at your config file(s)
konfigmap -f appsettings.json

# Scan a directory
konfigmap -d ./config -o ./k8s/overlays/dev

# Multiple files with prefix
konfigmap -f appsettings.json -f appsettings.Production.json -p "DOTNET_"

Usage

konfigmap [options]

Options

Input / Output (required: at least one of -f or -d)
Option Alias Description Default
--input-file -f One or more JSON config file paths to process
--input-dir -d One or more directories to scan recursively for JSON files
--output-dir -o Output directory for the generated file .
--output-file -O Output filename .env
Key Transformation
Option Alias Description Default
--separator -s Replaces : and . in hierarchical keys (ASP.NET Core uses __ for env vars) __
--prefix -p Prefix prepended to every key (e.g. DOTNET_, ASPNETCORE_) (empty)
Filtering
Option Alias Description Default
--exclude -e Regex — keys matching this are excluded (empty)
--include -i Regex — only keys matching this are included (empty)
Tokenization (for CI/CD)
Option Alias Description Default
--tokenize -t Replace values with tokenized placeholders false
--token-prefix Opening delimiter for tokens $(
--token-suffix Closing delimiter for tokens )
Output Control
Option Description Default
--leaf-only Emit only leaf (terminal) values, skip section keys true
--sort-keys Sort output keys alphabetically false
--dry-run Print to stdout without writing a file false

Examples

Basic: directory scan

konfigmap -d ./config -o ./k8s/overlays/dev

Multiple input files

konfigmap -f appsettings.json -f appsettings.Production.json -o ./k8s/overlays/prod

Prefix + custom separator

konfigmap -d ./config --prefix "DOTNET_" --separator "." -o ./output

Input (appsettings.json):

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=db;Database=myapp"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  }
}

Output (.env):

DOTNET_ConnectionStrings.DefaultConnection="Server=db;Database=myapp"
DOTNET_Logging.LogLevel.Default="Warning"

Tokenized output for CI/CD pipelines

konfigmap -f appsettings.json --tokenize --token-prefix "#{" --token-suffix "}#"

Output:

ConnectionStrings__DefaultConnection="#{ConnectionStrings__DefaultConnection}#"
Logging__LogLevel__Default="#{Logging__LogLevel__Default}#"

Filtering keys

# Exclude logging-related keys
konfigmap -f appsettings.json --exclude "Logging.*"

# Include only connection strings
konfigmap -f appsettings.json --include "ConnectionStrings.*"

Sorted + dry-run preview

konfigmap -d ./config --sort-keys --dry-run

Include parent keys

konfigmap -f appsettings.json --leaf-only false

Supported ASP.NET Core Configuration Patterns

KonfigMap handles all standard ASP.NET Core JSON configuration patterns, converting hierarchical JSON into flat key=value pairs using the :__ (double underscore) convention that ASP.NET Core uses for environment variables.

Nested Objects

{ "Logging": { "LogLevel": { "Default": "Information" } } }
Logging__LogLevel__Default="Information"

Arrays (index-based keys)

{ "AllowedOrigins": [ "https://app.example.com", "https://admin.example.com" ] }
AllowedOrigins__0="https://app.example.com"
AllowedOrigins__1="https://admin.example.com"

Arrays of Objects

{
  "Endpoints": [
    { "Name": "Primary", "Url": "https://primary.example.com" },
    { "Name": "Secondary", "Url": "https://secondary.example.com" }
  ]
}
Endpoints__0__Name="Primary"
Endpoints__0__Url="https://primary.example.com"
Endpoints__1__Name="Secondary"
Endpoints__1__Url="https://secondary.example.com"

Dotted Namespace Keys (e.g. Microsoft.AspNetCore)

Dots in key names are normalized to the separator (default __):

{ "Logging": { "LogLevel": { "Microsoft.AspNetCore": "Warning" } } }
Logging__LogLevel__Microsoft__AspNetCore="Warning"

Scalar Types (booleans, integers, floats)

{ "MaxRetries": 3, "EnableFeature": true, "Ratio": 0.75 }
MaxRetries="3"
EnableFeature="True"
Ratio="0.75"

Complex Real-World Config (Serilog, Kestrel, etc.)

{
  "Serilog": {
    "WriteTo": [
      { "Name": "Console" },
      { "Name": "File", "Args": { "path": "/var/log/app.log" } }
    ]
  }
}
Serilog__WriteTo__0__Name=Console
Serilog__WriteTo__1__Name=File
Serilog__WriteTo__1__Args__path=/var/log/app.log

Special Characters in Keys

Character Handling
: (colon) Replaced with separator (__) — this is the standard hierarchy delimiter
. (dot) Replaced with separator (__) — normalizes dotted namespace keys
- (dash) Preserved as-is
_ (underscore) Preserved as-is
Spaces Preserved as-is

Using with Kubernetes Kustomize

KonfigMap output integrates directly with Kustomize's configMapGenerator:

Step 1: Generate the properties file:

konfigmap -f appsettings.Production.json -o ./k8s/overlays/prod

Step 2: Reference in kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - deployment.yaml

configMapGenerator:
  - name: myapp-config
    envs:
      - .env

Step 3: Use in your deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
        - name: myapp
          image: myapp:latest
          envFrom:
            - configMapRef:
                name: myapp-config

License

MIT

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.

This package has no dependencies.

Version Downloads Last Updated
2.0.40 109 4/30/2026
1.0.10 377 12/3/2023
1.0.8 390 9/25/2023
1.0.7 315 9/19/2023
1.0.6 323 9/14/2023
1.0.5 290 9/11/2023