forked from oscar.krause/fastapi-dls
main.py - added some debug endpoints
This commit is contained in:
parent
fad0545942
commit
c647363b6d
18
README.md
18
README.md
@ -2,6 +2,24 @@
|
|||||||
|
|
||||||
Minimal Delegated License Service (DLS).
|
Minimal Delegated License Service (DLS).
|
||||||
|
|
||||||
|
## Endpoints
|
||||||
|
|
||||||
|
### `GET /`
|
||||||
|
|
||||||
|
Just a simple *hello world* endpoint.
|
||||||
|
|
||||||
|
### `GET /status`
|
||||||
|
|
||||||
|
Status endpoint, used for *healthcheck*.
|
||||||
|
|
||||||
|
### `GET /-/origins`
|
||||||
|
|
||||||
|
List registered origins.
|
||||||
|
|
||||||
|
### `GET /-/leases`
|
||||||
|
|
||||||
|
List current leases.
|
||||||
|
|
||||||
# Setup (Docker)
|
# Setup (Docker)
|
||||||
|
|
||||||
**Run this on the Docker-Host**
|
**Run this on the Docker-Host**
|
||||||
|
13
app/main.py
13
app/main.py
@ -5,6 +5,7 @@ from os.path import join, dirname
|
|||||||
from os import getenv
|
from os import getenv
|
||||||
from fastapi import FastAPI, HTTPException
|
from fastapi import FastAPI, HTTPException
|
||||||
from fastapi.requests import Request
|
from fastapi.requests import Request
|
||||||
|
from fastapi.encoders import jsonable_encoder
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
@ -60,6 +61,18 @@ async def status(request: Request):
|
|||||||
return JSONResponse({'status': 'up'})
|
return JSONResponse({'status': 'up'})
|
||||||
|
|
||||||
|
|
||||||
|
@app.get('/-/origins')
|
||||||
|
async def _origins(request: Request):
|
||||||
|
response = list(map(lambda x: jsonable_encoder(x), db['origin'].all()))
|
||||||
|
return JSONResponse(response)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get('/-/leases')
|
||||||
|
async def _leases(request: Request):
|
||||||
|
response = list(map(lambda x: jsonable_encoder(x), db['lease'].all()))
|
||||||
|
return JSONResponse(response)
|
||||||
|
|
||||||
|
|
||||||
# venv/lib/python3.9/site-packages/nls_core_service_instance/service_instance_token_manager.py
|
# venv/lib/python3.9/site-packages/nls_core_service_instance/service_instance_token_manager.py
|
||||||
@app.get('/client-token')
|
@app.get('/client-token')
|
||||||
async def client_token():
|
async def client_token():
|
||||||
|
Loading…
Reference in New Issue
Block a user