-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
The current .strata.yaml requires all environment configurations to be written in a single environments section. Writing production credentials (passwords, etc.) directly in the config file is a security risk, and teams managing different environments are prone to Git merge conflicts.
Proposed Solution
Support environment-specific override files .strata.<env>.yaml that are deep-merged with the base configuration.
Design
project/
├── .strata.yaml # Base config (shared)
├── .strata.development.yaml # Development overrides
├── .strata.staging.yaml # Staging overrides
└── .strata.production.yaml # Production overrides (recommended in .gitignore)
Merge Rules
- Load
.strata.yamlas the base configuration - If a
.strata.<env>.yamlfile exists for the environment specified by--env, deep-merge it into the base - Fields in the override file overwrite the same-named fields in the base
- Environment variable
STRATA_ENVcan also specify the environment name (--envtakes precedence)
Configuration Example
.strata.yaml (base):
version: "1.0"
dialect: postgresql
schema_dir: schema
migrations_dir: migrations
environments:
development:
host: localhost
port: 5432
database: myapp_dev.strata.production.yaml (override):
environments:
production:
host: db.production.internal
database: myapp_prod
ssl_mode: require
max_connections: 20Implementation Plan
-
Extend Config loader (
src/core/src/core/config.rs)- Add override file discovery logic to
Config::load() - Implement
Config::merge(base, override)method (deep merge of HashMaps)
- Add override file discovery logic to
-
Add
--envCLI argument (src/cli/src/cli/cli.rs)- Add
--env <ENV>as a global argument - Fall back to
STRATA_ENVenvironment variable
- Add
-
Update
.gitignoretemplate (strata init)- Suggest adding
.strata.production.yamlto.gitignoreby default
- Suggest adding
Files Affected
src/core/src/core/config.rs— Config::load() merge logicsrc/cli/src/cli/cli.rs—--envargumentsrc/cli/src/cli/commands/command_context.rs— Config loading flow changessrc/cli/src/cli/commands/init.rs— .gitignore template update
Alternatives Considered
- Environment variables only: Override all settings via
STRATA_DB_HOST, etc. Simple but file-based management is easier to maintain - TOML format: TOML excels at section management, but YAML consistency with the existing ecosystem is preferred
- Vault integration: HashiCorp Vault or similar secret management tools are future scope; file-based overrides come first
Additional Context
- Corresponds to "Support environment overrides in config" in ROADMAP.md
- The existing
Config::validate()must also apply to the merged result - Typical usage with Docker Compose:
STRATA_ENV=production strata apply
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request