This project is a minimal Configuration Service implemented with Flask. It is designed to act as a standalone
microservice within a broader ecosystem. The service provides versioned configuration storage per
(service, environment) pair and exposes a simple REST API to create, retrieve, and list configuration versions.
The repository supports two storage backends:
- File-based repository (for local development and simple setups)
- SQLAlchemy-based repository (for relational database persistence)
[UNDER CONSTRUCTION]
The project is intentionally minimal and intended as a walking skeleton. It will be extended with authentication, schema validation, caching, feature flags, and integration hooks.
- Health endpoint
- Versioned configuration storage
- Retrieve the latest or specific version
- Pluggable repository implementation
- JSON-based configuration payloads
config-service/
├── app.py
├── models.py
├── models_db.py
├── storage.py
├── repository_sqlalchemy.py
├── requirements.txt
└── data/ # used by file-based repository
- Python 3.10+
- pip
- Virtual environment tool (venv recommended)
Optional:
- PostgreSQL or other relational DB (for SQLAlchemy repository)
git clone https://github.com/olegood/lab-conf.git
cd lab-confLinux/macOS:
python3 -m venv venv
source venv/bin/activateWindows:
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtBy default, the app runs with the file-based repository.
python app.pyThe service will start at:
http://localhost:5000Health check:
GET /healthTo switch to database-backed storage:
- Modify app.py to use SQLAlchemyConfigRepository.
- Provide a database URL.
Example (SQLite for development):
repo = SQLAlchemyConfigRepository(
db_url="sqlite:///config.db"
)Example (PostgreSQL):
postgresql+psycopg://user:password@localhost:5432/configdb
When using SQLAlchemy for the first time, tables are auto-created via metadata.create_all(). In a production setting,
replace this with proper migrations (e.g., Alembic).
Create configuration:
POST /configs/lab-orgs/dev
Content-Type: application/json
{
"data": {
"timeout": 30,
"retries": 3
},
"created_by": "admin"
}
Get latest configuration:
GET /configs/lab-orgs/dev
Get a specific version:
GET /configs/lab-orgs/dev?version=<uuid>
List versions:
GET /configs/lab-orgs/dev/versions