Skip to content

Add environment variable overrides for configuration #86

@404-Page-Found

Description

@404-Page-Found

Problem

Configuration is currently stored in a JSON file (~/.config/commit-echo/config.json) and loaded at startup. There is no way to temporarily override config values for CI scripts, testing, or switching between projects without editing the config file.

Proposed Solution

Support environment variable overrides for all configuration options:

Config Key Environment Variable Description
\provider\ \COMMIT_ECHO_PROVIDER\ LLM provider key
\model\ \COMMIT_ECHO_MODEL\ Model name
\�aseUrl\ \COMMIT_ECHO_BASE_URL\ API base URL
\�piKey\ \COMMIT_ECHO_API_KEY\ API key
\historySize\ \COMMIT_ECHO_HISTORY_SIZE\ History size for style learning
\maxDiffSize\ \COMMIT_ECHO_MAX_DIFF_SIZE\ Max diff size in chars

Environment variables should take precedence over config file values.

Implementation Notes

  • Modify \src/config/store.ts\ — \loadConfig()\ should check env vars after parsing the JSON file
  • Env var values override the parsed config properties
  • Boolean/numeric vars need appropriate parsing (e.g., \COMMIT_ECHO_HISTORY_SIZE\ needs \parseInt)

Acceptance Criteria

  • All config options can be overridden via environment variables
  • Env vars take precedence over config file values
  • Missing env vars fall back to config file values
  • Tests verify override behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions