https://github.com/alexdemure/gadfastetcd
A FastAPI integration with Etcd for managing configuration settings via a RESTful API.
https://github.com/alexdemure/gadfastetcd
fastapi-etdc pydantic-etdc python-etdc
Last synced: about 1 year ago
JSON representation
A FastAPI integration with Etcd for managing configuration settings via a RESTful API.
- Host: GitHub
- URL: https://github.com/alexdemure/gadfastetcd
- Owner: AlexDemure
- License: mit
- Created: 2025-04-28T07:20:26.000Z (about 1 year ago)
- Default Branch: production
- Last Pushed: 2025-04-30T09:41:58.000Z (about 1 year ago)
- Last Synced: 2025-04-30T10:05:45.794Z (about 1 year ago)
- Topics: fastapi-etdc, pydantic-etdc, python-etdc
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A FastAPI integration with Etcd for managing configuration settings via a RESTful API
---
### Installation
```
pip install gadfastetcd
```
### Usage
#### API
Set
```curl
curl -X 'PUT' \
'http://127.0.0.1:8000/-/etcd' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"test": 1
}
```
Get
```
curl -X 'GET' \
'http://127.0.0.1:8000/-/etcd' \
-H 'accept: application/json'
{
"test": 1
}
```
#### Code
```python
import pydantic
import fastapi
from gadfastetcd import Etcd
class Settings(pydantic.BaseModel):
class Config:
extra = "allow"
settings = Settings()
etcd = Etcd(url="localhost:2379", storage="/{service_name}/{environment}", settings=settings)
app = fastapi.FastAPI()
app.include_router(etcd.router)
>>> settings.test
```
