Skip to content

feat: support environment variables in YAML configuration#790

Open
mvanhorn wants to merge 1 commit intoxataio:mainfrom
mvanhorn:feat/env-var-expansion-yaml
Open

feat: support environment variables in YAML configuration#790
mvanhorn wants to merge 1 commit intoxataio:mainfrom
mvanhorn:feat/env-var-expansion-yaml

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Apr 8, 2026

Summary

Adds os.ExpandEnv support to YAML config parsing so users can reference environment variables like ${DB_PASSWORD} in config files instead of hardcoding secrets.

Applied to all three YAML-backed parsing paths:

  • LoadFile (viper): reads file manually, expands env vars, feeds to viper.ReadConfig
  • ParseStreamConfig (yaml.Unmarshal): expands before the case-sensitive YAML parse
  • ParseTransformerConfig: expands before transformation rule parsing

Also handles the transformer rules merge path (PGSTREAM_TRANSFORMER_RULES_FILE).

Example config:

listener:
  postgres:
    conn: "postgres://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:5432/mydb"

Fixes #383

This contribution was developed with AI assistance (Codex).

Expand ${VAR} references in YAML config files using os.ExpandEnv
before parsing. This avoids exposing secrets in config files.

Applied to all three YAML parsing paths: LoadFile (viper),
ParseStreamConfig (yaml.Unmarshal), and ParseTransformerConfig.

Fixes xataio#383
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.

[Config] Support for env variables in yaml configuration

1 participant