Skip to content

Config Service API

βš™οΈ

A centralized configuration management REST API built with Java, Spring Boot, and PostgreSQL. Manages application configurations, feature flags, and dynamic property management across all microservices.


Features

Feature Description Icon
Centralized Config Single source of truth for all service configurations πŸ“‹
Feature Flags Toggle features on/off without redeployment 🚩
Environment Profiles Support local, UAT, and production configurations 🌍
Version Control Track configuration changes with audit trail πŸ“œ
Dynamic Reloading Update configs without service restart πŸ”„
Encryption at Rest Secure sensitive configuration values πŸ”
Multi-Tenant Support Manage configs per tenant 🏒

Architecture Overview

flowchart TD
    A[Microservice] -->|REST API| B(ConfigController)
    B --> C[ConfigService]
    C --> D[ConfigRepository]
    D --> E[(PostgreSQL)]
    C --> F[Git Repository]
    B --> G[FeatureFlagService]
    G --> H[Cache]
Hold "Alt" / "Option" to enable pan & zoom

API Endpoints

Method Endpoint Description Notes/Parameters
POST /api/v1/config/properties Create configuration property tenantId header, config data
GET /api/v1/config/properties/{key} Get config property by key
GET /api/v1/config/properties List all properties (paginated) tenantId param, profile filter
PUT /api/v1/config/properties/{key} Update configuration property New value
DELETE /api/v1/config/properties/{key} Delete configuration property
POST /api/v1/config/features Create feature flag Feature definition
GET /api/v1/config/features/{name} Get feature flag status
PUT /api/v1/config/features/{name} Toggle feature flag Enabled/disabled
GET /api/v1/config/history Get configuration change history Date range filter
GET /api/v1/config/validate Validate configuration Optional property names

Sequence: Update Configuration Property

sequenceDiagram
    participant U as User
    participant API as ConfigController
    participant S as ConfigService
    participant R as ConfigRepository
    participant G as Git
    participant C as Cache
    U->>API: PUT /properties/{key} (new value)
    API->>S: validate and update
    S->>R: save configuration
    R-->>S: saved
    S->>G: commit change to repo
    G-->>S: committed
    S->>C: invalidate cache
    C-->>S: cache cleared
    S-->>API: ConfigResponse
    API-->>U: 200 OK + updated property
Hold "Alt" / "Option" to enable pan & zoom

Database Schema

erDiagram
    config_properties {
        UUID id PK
        UUID tenant_id
        VARCHAR property_key
        TEXT property_value
        VARCHAR profile
        VARCHAR property_type
        TIMESTAMP created
        TIMESTAMP updated
        VARCHAR created_by
    }

    feature_flags {
        UUID id PK
        UUID tenant_id
        VARCHAR feature_name
        BOOLEAN enabled
        TEXT description
        TIMESTAMP created
        TIMESTAMP updated
    }

    config_history {
        UUID id PK
        UUID property_id FK
        VARCHAR old_value
        VARCHAR new_value
        TIMESTAMP changed_at
        VARCHAR changed_by
    }

    config_properties ||--o{ config_history : "tracked_in"
Hold "Alt" / "Option" to enable pan & zoom

Getting Started

Prerequisites

  • Java 17+
  • PostgreSQL
  • Gradle

Setup

git clone https://github.com/Olanna-tech/config-service-java.git
cd config-service-java
./gradlew build

Database

  • Configure your PostgreSQL credentials in src/main/resources/application.yml.
  • Run Flyway migrations (auto on startup).

Run

./gradlew bootRun

Configuration

Set the following environment variables in application.yml:

config:
  git-repo-url: https://github.com/your-org/config-repo
  git-branch: main
  cache-ttl-minutes: 30
  encryption-enabled: true


Contributing

Pull requests are welcome! For major changes, please open an issue first.


License

MIT


Contact