Skip to content

Config Loading Refactor: Replace hand-rolled loader with Gestalt #8

@coopernetes

Description

@coopernetes

Current State

The config loading system is hand-rolled:

  • JettyConfigurationLoader — 3-tier YAML loader (base → local override → env vars)
  • JettyConfigurationBuilder — casts raw Map<String, Object> into domain objects

Pain Points

  • Partial env var coverage — only simple scalar keys; complex structures (whitelist filters, regex patterns) can't be overridden via env vars
  • No profiles — no git-proxy-prod.yml / git-proxy-dev.yml activation
  • No type safety — raw Map<String, Object> throughout; type mismatches surface at runtime
  • No validation — bad config silently produces defaults or runtime exceptions
  • No cloud config integration — no Vault, AWS SSM, or Kubernetes Secrets support

Proposed Solution: Replace with Gestalt

Gestalt is a lightweight, container-free config library that covers all current gaps natively.

Feature Today Gestalt
YAML loading
File merging / layering ✅ manual ✅ native
Env var overrides ⚠️ partial ✅ full
Profile activation
Type-safe POJO binding
Startup validation (JSR-380)
Cloud config (Vault, SSM, K8s)

Tasks

  • Add gestalt-core + gestalt-yaml dependencies to jgit-proxy-server/build.gradle
  • Define typed config records/POJOs (ServerConfig, ProviderConfig, CommitConfig, DatabaseConfig) to replace Map<String, Object> casts in JettyConfigurationBuilder
  • Replace JettyConfigurationLoader with a GestaltBuilder composition (base → profile → local override → env vars)
  • Simplify JettyConfigurationBuilder — replace all raw map casts with gestalt.getConfig(...)
  • Update entry points GitProxyJettyApplication and GitProxyWithDashboardApplication to use the Gestalt-backed loader
  • Add profile activation via GITPROXY_PROFILE env var

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions