Skip to main content

Cascading Configuration Manager - deep-merge configuration files across multiple directories

Project description

CasConf

Cascading Configuration Manager

CasConf is a flexible configuration management tool that deep-merges configuration files across multiple directories following a cascading pattern.

Overview

CasConf scans a configurable list of directories for matching configuration files and intelligently deep-merges them based on discovery order. The result is a single, unified configuration that respects the cascade hierarchy you define.

Key Features

  • Deep Merging: Recursively merges nested configuration structures
  • Format Agnostic: Supports JSON, YAML, TOML, and INI formats
  • Configurable Discovery: Define your own directory scan order

Use Cases

  • Application configuration across development, staging, and production environments
  • User-specific configuration overrides (system → user → project)
  • Plugin or module configuration aggregation
  • Multi-tenant configuration management
  • Dotfile management and system configuration

Documentation

Installation

# From PyPI (when published)
pip install casconf

# From source
pip install git+https://github.com/ConsoleCatzirl/casconf.git@main

Basic Usage

Command-Line Interface

# Merge configs and output to stdout (default)
casconf --discovery-config ./casconf.yaml

# Output to a file
casconf --discovery-config ./casconf.yaml --output ./merged.json

# Specify output format
casconf --discovery-config ./casconf.yaml --format yaml

# Configure with environment variables
export CASCONF_DISCOVERY=./casconf.yaml
export CASCONF_OUTPUT=./merged.json
export CASCONF_FORMAT=json
casconf

# Pipe to other tools
casconf | jq '.database'

Library Usage

from casconf import merge_configs

# Merge and return configuration data
config_data = merge_configs(discovery_config='./casconf.yaml')

# Merge and write to file in one call
merge_configs(
    discovery_config='./casconf.yaml',
    output='./output/config.json',
    output_format='json'
)
from casconf import merge_configs, DiscoveryConfig

# Build a DiscoveryConfig programmatically (no file required)
discovery = DiscoveryConfig(
    directories=[
        '/etc/myapp/defaults',
        '/etc/myapp/$ENVIRONMENT',   # expanded at runtime, e.g. production
        '~/.config/myapp',
    ],
    patterns=['config.json', 'config.yaml'],
    merge_strategy='deep',
)

config = merge_configs(discovery_config=discovery)

Discovery Configuration

CasConf uses a discovery configuration file to determine where to search for configuration files:

# casconf.yaml
directories:
  - /etc/myapp/defaults        # site-wide defaults
  - /etc/myapp/$ENVIRONMENT    # environment-specific overrides, e.g. production, staging
  - /etc/myapp/$HOSTNAME       # host-specific overrides, e.g. web-01.example.com
  - ~/.config/myapp            # user overrides (highest priority)

patterns:
  - "config.json"
  - "config.yaml"
  - "*.conf.json"

merge_strategy: deep  # or 'shallow'

Directory paths support ~ expansion and $VAR / ${VAR} environment variable expansion. Missing directories are skipped with a warning — no error is raised. See USAGE.md for a full walkthrough.

License

This project is dual-licensed:

  • MIT License: When used as a standalone executable (CLI tool)
  • GNU General Public License v3.0 (GPL-3.0): When imported or linked as a library

See LICENSE for full details.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

This project follows PEP 8 style guidelines and emphasizes simplicity and maintainability.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

casconf-0.1.2.tar.gz (55.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

casconf-0.1.2-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file casconf-0.1.2.tar.gz.

File metadata

  • Download URL: casconf-0.1.2.tar.gz
  • Upload date:
  • Size: 55.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for casconf-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5e40e0deee1f3c5d72c28402edf658aee71dccbe2d795a5203ac96f69eb975e8
MD5 32f585270e1da6aa72490da5669efd17
BLAKE2b-256 f0c9aa16f6328a3a016d938def58f0a395f4c72f9911ad807467b07525fe8a49

See more details on using hashes here.

Provenance

The following attestation bundles were made for casconf-0.1.2.tar.gz:

Publisher: release.yaml on ConsoleCatzirl/casconf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file casconf-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: casconf-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for casconf-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7e81d6f03faf2b23617c8940ba2f089b4e253c49f375e62a45e9481a106ead5a
MD5 f4c7b4d8cedeee738b9f9960bd684d09
BLAKE2b-256 23347a397cdd5727d925f35c1235dfd5d66bc27f48ada9495f351dad806ecfb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for casconf-0.1.2-py3-none-any.whl:

Publisher: release.yaml on ConsoleCatzirl/casconf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page