Mercurial > code > home > repos > racc
diff console/console.py @ 5:5a99bde7a506
stub py service for console
author | drewp@bigasterisk.com |
---|---|
date | Mon, 13 Mar 2023 18:52:00 -0700 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/console/console.py Mon Mar 13 18:52:00 2023 -0700 @@ -0,0 +1,32 @@ + +import logging +import os +import socket +import sys + +import uvicorn +from prometheus_client import Gauge +from starlette.applications import Starlette +from starlette.requests import Request +from starlette.responses import HTMLResponse +from starlette.routing import Mount +from starlette.staticfiles import StaticFiles +from starlette_exporter import PrometheusMiddleware, handle_metrics + + + + +def main(): + app = Starlette(debug=True, + routes=[ + # Mount('/', app=StaticFiles(directory='.'), name="static"), + ], +) + + app.add_middleware(PrometheusMiddleware, app_name='racc_console') + app.add_route("/metrics", handle_metrics) + uvicorn.run(app, host='0.0.0.0', port=8000) + + +if __name__ == "__main__": + main() \ No newline at end of file