Skip to content

feat: add configuration file support (distill.yaml)#18

Merged
Siddhant-K-code merged 2 commits into
mainfrom
feat/config-file-support
Feb 14, 2026
Merged

feat: add configuration file support (distill.yaml)#18
Siddhant-K-code merged 2 commits into
mainfrom
feat/config-file-support

Conversation

@Siddhant-K-code

Copy link
Copy Markdown
Owner

Motivation

CLI flags are tedious for repeated use. A config file enables consistent settings across invocations and easier deployment configuration.

Closes #10

Changes

  • pkg/config/ — Config schema, file loading, validation, and ${VAR} / ${VAR:-default} environment variable interpolation
  • cmd/config.godistill config init (generate template) and distill config validate (check config file)
  • cmd/api.go / cmd/serve.go — Viper bindings so config file values serve as fallbacks for CLI flags
  • cmd/root.go — Updated config loading: searches for distill.yaml (not .distill), uses DISTILL_ env prefix with key replacer
  • README.md — Config file documentation with example YAML

Config priority

CLI flags > environment variables > config file > defaults

Example

server:
  port: 8080
  host: 0.0.0.0

dedup:
  threshold: 0.15
  linkage: average
  lambda: 0.5

retriever:
  backend: pinecone
  index: my-index
  top_k: 50
  target_k: 8

auth:
  api_keys:
    - ${DISTILL_API_KEY}

Testing

  • 15 unit tests covering: defaults, validation (port, threshold, lambda, backend, linkage), env interpolation, file loading, partial configs, invalid YAML, template generation
  • CI will run go test ./... and golangci-lint

Add distill.yaml config file support with:
- pkg/config: schema, loading, validation, env var interpolation
- distill config init: generate config template
- distill config validate: validate config files
- Viper bindings for api/serve commands to read from config
- Updated root.go config loading (distill.yaml, DISTILL_ env prefix)
- README documentation for config file usage

Config priority: CLI flags > env vars > config file > defaults.
Environment variables referenced via ${VAR} or ${VAR:-default}.

Closes #10

Co-authored-by: Ona <[email protected]>
@Siddhant-K-code Siddhant-K-code added the enhancement New feature or request label Feb 14, 2026
@Siddhant-K-code Siddhant-K-code merged commit ee88338 into main Feb 14, 2026
2 checks passed
@Siddhant-K-code Siddhant-K-code deleted the feat/config-file-support branch February 14, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Configuration File Support

1 participant