mirror of
https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
synced 2024-12-27 16:08:55 +00:00
implemented '/-/config' endpoint to list runtime environment variables
This commit is contained in:
parent
34662e6612
commit
2e950ca6f4
@ -25,7 +25,11 @@ Status endpoint, used for *healthcheck*. Shows also current version and commit h
|
||||
|
||||
### `GET /-/health`
|
||||
|
||||
Status endpoint, used for *healthcheck*. Shows also current version and commit hash.
|
||||
Status endpoint, used for *healthcheck*.
|
||||
|
||||
### `GET /-/config`
|
||||
|
||||
Shows current runtime environment variables and their values.
|
||||
|
||||
### `GET /-/readme`
|
||||
|
||||
|
19
app/main.py
19
app/main.py
@ -81,7 +81,24 @@ async def _index():
|
||||
|
||||
@app.get('/-/health', summary='* Health')
|
||||
async def _health(request: Request):
|
||||
return JSONResponse({'status': 'up', 'version': VERSION, 'commit': COMMIT, 'debug': DEBUG})
|
||||
return JSONResponse({'status': 'up'})
|
||||
|
||||
|
||||
@app.get('/-/config', summary='* Config', description='returns environment variables.')
|
||||
async def _config():
|
||||
return JSONResponse({
|
||||
'VERSION': VERSION,
|
||||
'COMMIT': COMMIT,
|
||||
'DEBUG': DEBUG,
|
||||
'DLS_URL': DLS_URL,
|
||||
'DLS_PORT': DLS_PORT,
|
||||
'SITE_KEY_XID': SITE_KEY_XID,
|
||||
'INSTANCE_REF': INSTANCE_REF,
|
||||
'TOKEN_EXPIRE_DELTA': TOKEN_EXPIRE_DELTA,
|
||||
'LEASE_EXPIRE_DELTA': LEASE_EXPIRE_DELTA,
|
||||
'LEASE_RENEWAL_PERIOD': LEASE_RENEWAL_PERIOD,
|
||||
'CORS_ORIGINS': CORS_ORIGINS,
|
||||
})
|
||||
|
||||
|
||||
@app.get('/-/readme', summary='* Readme')
|
||||
|
@ -56,6 +56,11 @@ def test_health():
|
||||
assert response.json()['status'] == 'up'
|
||||
|
||||
|
||||
def test_config():
|
||||
response = client.get('/-/')
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_readme():
|
||||
response = client.get('/-/readme')
|
||||
assert response.status_code == 200
|
||||
|
Loading…
Reference in New Issue
Block a user