https://github.com/ar-ecommerce-platform/config-server
Centralized configuration service
https://github.com/ar-ecommerce-platform/config-server
centralized-configuration config-server git-backed-config microservices spring-boot spring-cloud-config
Last synced: 3 months ago
JSON representation
Centralized configuration service
- Host: GitHub
- URL: https://github.com/ar-ecommerce-platform/config-server
- Owner: ar-ecommerce-platform
- Created: 2025-08-18T06:13:21.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-10-16T00:26:29.000Z (9 months ago)
- Last Synced: 2025-10-17T02:15:16.451Z (9 months ago)
- Topics: centralized-configuration, config-server, git-backed-config, microservices, spring-boot, spring-cloud-config
- Language: Java
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ ๏ธ Config Server โ E-commerce Backend
[](https://github.com/ar-ecommerce-platform/config-server/actions/workflows/ci-config-server.yml)
[](https://sonarcloud.io/summary/new_code?id=ar-ecommerce-platform_config-server)
[](https://sonarcloud.io/summary/new_code?id=ar-ecommerce-platform_config-server)
[](https://snyk.io/test/github/ar-ecommerce-platform/config-server)
Centralized configuration service for all microservices in the E-commerce backend. Fetches and distributes configuration properties from a remote Git repository.
---
## ๐ง Tech Stack
- **Java**
- **Spring Boot**
- **Spring Cloud Config Server**
- **Git (Remote Config Repo)**
- **Docker**
---
## ๐ Features
- ๐ฆ Centralized and externalized configuration for all microservices
- ๐ Supports multiple environments (`dev`, `prod`, etc.)
- ๐ Dynamic reload (Spring Cloud Bus support on client-side)
- ๐ Separation of sensitive values from application code
- ๐ Git-backed storage for version-controlled configuration
---
## ๐งฑ Architecture Overview
The Config Server reads configuration files from a centralized Git repository and exposes them to all microservices at runtime. This allows consistent configuration management across environments.
๐ Config Repository: https://github.com/ar-ecommerce-platform/config-repo
๐ Config access URL pattern:
`http://localhost:8888/{application}/{profile}`
All services are configured to use this server via:
```yaml
spring:
config:
import: configserver:http://localhost:8888
```
---
## ๐งพ Example: Microservice application.yml
To connect your service to the Config Server, add the following to your application.yml:
```yaml
spring:
application:
name: inventory-service-dev # This must match the config file name in the config repo
config:
import: configserver:http://localhost:8888 # Tells Spring to fetch config from the Config Server
```
๐ Make sure your Config Server is running and points to the correct Git repo!
---
## ๐ Directory Structure
```
config-server/
โโโ src/
โ โโโ main/
โ โ โโโ java/com/ecommerce/ecommerce_config_server/
โ โ โ โโโ EcommerceConfigServerApplication.java # Main Spring Boot app
โ โ โโโ resources/
โ โ โโโ application.yml # Optional default Spring Boot properties
โ โ โโโ bootstrap.yml # Config Server bootstrap properties
โ โโโ smoke/
โ โ โโโ java/com/ecommerce/ecommerce_config_server/
โ โ โโโ ConfigServerSmokeTest.java # Smoke test for Config Server
โ โโโ test/
โ โโโ java/com/ecommerce/ecommerce_config_server/
โ โ โโโ EcommerceConfigServerApplicationTests.java # Unit & context load tests
โ โโโ resources/
โ โโโ application-test.yml # Test profile config (Spring Boot 3 format)
โ โโโ config-repo/
โ โโโ application.yml # Local test repo content served by Config Server
โโโ build.gradle
โโโ Dockerfile
โโโ .github/
โ โโโ workflows/
โ โโโ ci-config-server.yml # CI workflow for Config Server
```
---
## โ๏ธ Configuration
The server pulls all config files from a remote Git repository using the following setup:
```yaml
spring:
cloud:
config:
server:
git:
uri: https://github.com/ar-ecommerce-platform/config-repo
```
---
## ๐งช Testing Strategy
The `config-server` is validated with **smoke tests** to ensure reliable startup and connectivity.
### โ
What We're Testing
- **Service Boot & Health** โ Verifies the config server starts up and reports healthy status.
- **Git Integration** โ Confirms that configs are pulled correctly from the remote Git repository.
- **Profile-Specific Resolution** โ Checks that services receive the correct environment configs (e.g., `dev`, `prod`).
- **Fallback Behavior** โ Ensures graceful responses for unknown profiles or services using global defaults.
### ๐ง Why This Matters
In production, configuration servers are a critical part of system startup. If they fail, services may boot with incorrect or missing properties. These tests simulate realistic interactions and edge cases to guarantee stability under normal and degraded conditions.
### โ๏ธ How It's Done
- Uses **Testcontainers** to spin up a real Docker container of the config server.
- Sends real HTTP requests (via RestAssured) to endpoints like `/auth-service/dev`.
- Validates:
- That correct YAML files are resolved and merged.
- That the `/actuator/health` endpoint reports `UP` (smoke test).
- That default and global fallbacks are applied as expected.
---
## ๐ Main Project Page
For the main E-commerce backend platform repository and all related projects, visit:
https://github.com/ar-ecommerce-platform