Metadata-Version: 2.1
Name: gadfastetcd
Version: 0.0.1
Summary: A FastAPI integration with Etcd for managing configuration settings via a RESTful API
Home-page: https://github.com/AlexDemure/gadfastetcd
Author: Alexander Grishchenko
Author-email: alexanderdemure@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

<p align="center">
  <a href="https://github.com/AlexDemure/gadfastetcd">
    <a href="https://ibb.co/ZzpzbS7g"><img src="https://i.ibb.co/pjBjkQ5K/logo.png" alt="logo" border="0"></a>
  </a>
</p>

<p align="center">
  A FastAPI integration with Etcd for managing configuration settings via a RESTful API
</p>

---

### 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
```
