Skip to content

config: split ServerOptions into CharonOptions and ProxyOptions#76

Merged
elevran merged 2 commits into
mainfrom
worktree-todo-and-config-split
Jul 8, 2026
Merged

config: split ServerOptions into CharonOptions and ProxyOptions#76
elevran merged 2 commits into
mainfrom
worktree-todo-and-config-split

Conversation

@elevran

@elevran elevran commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces the single config.ServerOptions grab-bag with two focused types:
    • CharonOptions — storage server config (listen, data dir, TTL, chain limits, worker interval, telemetry)
    • ProxyOptions — proxy config (listen, inference backend/apikey/timeout, charon URL, telemetry)
  • Each type has its own New*, AddFlags, Complete, and Validate
  • YAML config file structure (proxy.*, charon.*, telemetry.*) is unchanged — existing config files keep working
  • Migrates cmd/charon and cmd/proxy to use their respective types
  • Removes the TODO comment added in PR pkg restructure: pkg/charon, internal/server, cmd/proxy #71 about the config split

Closes

Closes #74
Part of #75 (resolves the config-split TODO item)

Test plan

  • make presubmit passes
  • go test ./internal/config/... covers both CharonOptions and ProxyOptions defaults, file loading, CLI override, and validation

…75)

Replace the single config.ServerOptions with two focused types:

  CharonOptions  – listen, storage (data dir, TTL, max-*, chain depth),
                   worker interval, telemetry (service name + exporter URL)

  ProxyOptions   – listen, inference backend/apikey/timeout, charon URL,
                   telemetry (service name + exporter URL)

Each type has its own New*, AddFlags, Complete, and Validate. The YAML
config file structure (proxy.*, charon.*, telemetry.*) is unchanged so
existing config files continue to work.

Migrate cmd/charon and cmd/proxy to use their respective types. Remove
the grab-bag ServerOptions and the TODO comment it left behind.

Closes #74
Resolves TODO from #75 (config split task)

Signed-off-by: Etai Lev Ran <elevran@gmail.com>

@elevran elevran left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean split of ServerOptions into focused CharonOptions and ProxyOptions. Field renames are consistent across cmd/, the config package, and the tests; the YAML structure is preserved so existing config files keep working. All 6 CI checks green.

A few small things worth addressing before merge — most are simplify/ponytail cleanups, plus one test-coverage gap.

  • yagni: fileProxyConfig.Enabled (line 21 of internal/config/options.go) is now dead. The old ServerOptions.Complete consumed fc.Proxy.Enabled to drive ProxyEnabled; that consumer is gone, so nothing reads this anymore. Drop the field (and any applyFileDefaults/docs references) to keep the YAML schema honest.
  • Docs note: thoughts/shared/tech_debt_and_architecture_review_2026-07.md still references config.NewServerOptions() and the ProxyEnabled / ProxyListen / InferenceTimeoutSeconds fields that this PR removes. Not blocking, but the doc will be stale once this lands.

Comment thread internal/config/options.go Outdated
Comment thread internal/config/options.go Outdated
Comment thread internal/config/options.go
Comment thread internal/config/options_test.go
…Validate, test coverage

- Extract (*TelemetryOptions).AddFlags(fs) so --telemetry-exporter-url is
  registered once and called from both CharonOptions and ProxyOptions
- Extract visitedFlags(fs) helper to remove duplicated map+Visit pattern
  from both Complete methods
- Give CharonOptions.Validate() a real check: returns error when DataDir is empty
- Add TestProxyOptionsBackendCLIOverridesFile and
  TestProxyOptionsCharonURLCLIOverridesFile to cover the merge semantics for
  --backend and --charon-url
- Drop dead fileProxyConfig.Enabled field (its consumer, ServerOptions, is gone)

Signed-off-by: Etai Lev Ran <elevran@gmail.com>
@elevran elevran merged commit a662941 into main Jul 8, 2026
6 checks passed
elevran added a commit that referenced this pull request Jul 8, 2026
* config: split ServerOptions into CharonOptions and ProxyOptions (#74, #75)

Replace the single config.ServerOptions with two focused types:

  CharonOptions  – listen, storage (data dir, TTL, max-*, chain depth),
                   worker interval, telemetry (service name + exporter URL)

  ProxyOptions   – listen, inference backend/apikey/timeout, charon URL,
                   telemetry (service name + exporter URL)

Each type has its own New*, AddFlags, Complete, and Validate. The YAML
config file structure (proxy.*, charon.*, telemetry.*) is unchanged so
existing config files continue to work.

Migrate cmd/charon and cmd/proxy to use their respective types. Remove
the grab-bag ServerOptions and the TODO comment it left behind.

Closes #74
Resolves TODO from #75 (config split task)

Signed-off-by: Etai Lev Ran <elevran@gmail.com>

* config: extract TelemetryOptions.AddFlags, visitedFlags helper, real Validate, test coverage

- Extract (*TelemetryOptions).AddFlags(fs) so --telemetry-exporter-url is
  registered once and called from both CharonOptions and ProxyOptions
- Extract visitedFlags(fs) helper to remove duplicated map+Visit pattern
  from both Complete methods
- Give CharonOptions.Validate() a real check: returns error when DataDir is empty
- Add TestProxyOptionsBackendCLIOverridesFile and
  TestProxyOptionsCharonURLCLIOverridesFile to cover the merge semantics for
  --backend and --charon-url
- Drop dead fileProxyConfig.Enabled field (its consumer, ServerOptions, is gone)

Signed-off-by: Etai Lev Ran <elevran@gmail.com>

---------

Signed-off-by: Etai Lev Ran <elevran@gmail.com>
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.

feat: split configuration into proxy and state storage servers

1 participant