Skip to main content

Configuration Files Hierarchy

Overview​

This document describes a binary-based configuration file ordering system inspired by Linux file permissions. The system provides a predictable and logical way to manage configuration overrides from the most general to the most specific settings.

Core Concept​

naming

In this example, to make it simple i'll use direct names cloud, account, and environment as configuration scopes. In real scenarios, you'll use the actual names like aws, enterprise, production, etc.

{cloud}-{account}-{environment}.values.yaml

The system uses a 3-bit binary representation where each bit position represents a configuration scope:

  • Bit 2: Cloud
  • Bit 1: Account
  • Bit 0: Environment

Each bit can be:

  • 0 - Component not specified
  • 1 - Component specified

Binary to Configuration Mapping​

The binary value directly translates to the configuration file name and its override priority:

BinaryDecimalConfiguration FileDescription
0000values.yamlBase configuration (most general)
0011environment.values.yamlEnvironment-specific
0102account.values.yamlAccount-specific
0113account-environment.values.yamlAccount + Environment
1004cloud.values.yamlCloud-specific
1015cloud-environment.values.yamlCloud + Environment
1106cloud-account.values.yamlCloud + Account
1117cloud-account-environment.values.yamlAll components (most specific)
Override Hierarchy

Configuration files are loaded in ascending order (0β†’7), with each subsequent file overriding values from previous ones!

Best Practices​

  • Start general: Always begin with values.yaml for defaults
  • Be selective: Only create configuration files for combinations you actually need
  • Document overrides: Comment why specific values are overridden at each level
  • Avoid duplication: Only include values that differ from lower-priority files
  • Validate hierarchy: Regularly review the override chain to ensure it matches intentions

Conclusion​

This binary-based configuration system provides a robust, scalable, and intuitive approach to managing complex configuration hierarchies. The mathematical foundation ensures consistency while the clear naming convention maintains readability and maintainability.