Skip to content

Add local config override support and full environment hierarchy to EnvironmentConfiguration#261

Merged
michaelbeale-IL merged 2 commits into
masterfrom
copilot/add-environment-configuration-support
Feb 23, 2026
Merged

Add local config override support and full environment hierarchy to EnvironmentConfiguration#261
michaelbeale-IL merged 2 commits into
masterfrom
copilot/add-environment-configuration-support

Conversation

Copilot AI commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

EnvironmentConfiguration had environment detection and single-file resolution but was missing the third tier of the config hierarchy (config.local.json) and a way to retrieve the full ordered file list for layered loading.

Changes

EnvironmentConfiguration / IConfigurationManager

  • GetLocalOverrideFilePath(baseFilePath) — derives the .local.json path (e.g. config.local.json) unconditionally; callers decide whether to act on its existence
  • GetConfigurationFiles(baseFilePath) — returns an ordered IReadOnlyList<string> of existing files representing the full hierarchy (base → env-specific → local); uses Path.GetFullPath + case-insensitive comparison to prevent duplicates when paths alias the same file

Test coverage
Added 14 tests to ConfigurationEnhancementsTests:

  • Explicit detection of all four environments (Development, Testing, Staging, Production) via ACAT_ENVIRONMENT
  • Case-insensitive env var parsing
  • Fallback chain: ACAT_ENVIRONMENTDOTNET_ENVIRONMENTASPNETCORE_ENVIRONMENT
  • GetLocalOverrideFilePath (valid path, null input)
  • GetConfigurationFiles across all hierarchy combinations (base-only, base+env, all three layers, base+local)

Housekeeping

  • .gitignore — added *.local.json so developer override files are never accidentally committed
  • README.md / CONFIGURATION_ENHANCEMENT_GUIDE.md — documented the four-level hierarchy and local override workflow

Usage

var envConfig = new EnvironmentConfiguration(logger);
envConfig.SetEnvironment(ConfigurationEnvironment.Development);

// Returns e.g. ["config.json", "config.Development.json", "config.local.json"]
// (only files that exist on disk, in merge order)
IReadOnlyList<string> files = envConfig.GetConfigurationFiles("config.json");
Original prompt

This section details on the original issue you should resolve

<issue_title>Environment-Specific Configuration</issue_title>
<issue_description>Support development/production/test configuration files with layering.

Acceptance Criteria:

  • Environment detection (dev/prod/test)
  • Base + override config file loading
  • Environment variable override support
  • Documentation for environment setup
  • Tests for all environments

Configuration Hierarchy:

  1. Base configuration (config.json)
  2. Environment configuration (config.dev.json)
  3. Local overrides (config.local.json - gitignored)
  4. Environment variables (ACAT_* prefix)

Files to Create:

  • Libraries/ACATCore/Utility/EnvironmentConfiguration.cs
  • Environment detection logic
  • Config file resolution logic

Epic: Configuration System Enhancement

Estimated Effort: 2 days


Parent Feature: #191 - Configuration System Enhancement

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…or all environments

Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for environment-specific configuration files Add local config override support and full environment hierarchy to EnvironmentConfiguration Feb 23, 2026
@michaelbeale-IL michaelbeale-IL marked this pull request as ready for review February 23, 2026 19:41
@michaelbeale-IL michaelbeale-IL merged commit 961de8b into master Feb 23, 2026
@michaelbeale-IL michaelbeale-IL deleted the copilot/add-environment-configuration-support branch February 23, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environment-Specific Configuration

2 participants