refactor(config): unify all config types in gkg-server-config crate

Summary

Moves all configuration struct definitions into gkg-server-config so any crate in the workspace can access config types without pulling in heavy runtime dependencies (indexer, clickhouse driver, tonic, etc.).

  • 20+ config types consolidated from 5 crates (clickhouse-client, indexer, health-check, gitlab-client, gkg-server) into gkg-server-config
  • gkg-server-config gains only 2 new deps: config (YAML loading) and thiserror
  • Runtime methods stay in their original crates: build_client() via ClickHouseConfigurationExt trait, load_tls_config() as a free function in gkg-server
  • Source crates re-export types for backward compatibility
  • Removed dead from_env() methods that were never called (legacy parallel config path)
  • Fixed HealthCheckConfig default/serde divergence bug (serde default was missing "nats" in services list)
  • Restored 15 NatsConfiguration unit tests lost during file replacement

Config loading architecture

All configuration flows through a single path: AppConfig::load(), which layers three sources in order:

  1. config/default.yaml — baked into the repo, provides development defaults
  2. SecretFileSource (/etc/secrets/) — reads K8s-mounted secret volumes where each key is a file (e.g. /etc/secrets/gitlab/jwt/signing_key), mapped to dot-separated config keys. Keeps credentials out of env vars and kubectl describe pod output.
  3. GKG_* environment variables — Helm chart overrides for per-environment infrastructure settings (e.g. GKG_GRAPH__URL, GKG_NATS__URL). __ is the nesting separator.

Later sources override earlier ones. The removed from_env() methods were a dead parallel path that used different env var prefixes (NATS_URL vs GKG_NATS__URL) and were never called.

What moved

Types From To
AppConfig, SecretFileSource, GrpcConfig, MetricsConfig, TlsConfig, GitlabConfig, JwtConfig, ConfigError gkg-server gkg-server-config::app, grpc, metrics, tls, gitlab
ClickHouseConfiguration, ProfilingConfig, ConfigurationError clickhouse-client gkg-server-config::clickhouse
NatsConfiguration indexer gkg-server-config::nats
EngineConfiguration, HandlerConfiguration, ScheduleConfiguration, ScheduleConfig, + 10 handler/dispatcher configs indexer gkg-server-config::engine
HealthCheckConfig health-check gkg-server-config::health_check
GitlabClientConfiguration gitlab-client gkg-server-config::gitlab

What stays in original crates

Crate Keeps Why
clickhouse-client ClickHouseConfigurationExt::build_client() Needs ArrowClickHouseClient (orphan rule)
gkg-server load_tls_config() free function Needs tonic::transport
indexer IndexerConfig struct Aggregates config for indexer::run() — follow-up to eliminate

Follow-up

IndexerConfig still mirrors AppConfig fields and is manually constructed in main.rs. Now that AppConfig lives in the shared crate, the indexer can accept &AppConfig directly — tracked as a separate MR.

Edited by Michael Usachenko

Merge request reports

Loading