|
|
|
@ -3,9 +3,9 @@ import os |
|
|
|
|
from motor.motor_asyncio import AsyncIOMotorClient |
|
|
|
|
from sanic import Sanic, response, exceptions |
|
|
|
|
|
|
|
|
|
MONGO_URI = os.getenv("MONGO_URI") |
|
|
|
|
if not MONGO_URI: |
|
|
|
|
raise ValueError("No MONGO_URI specified") |
|
|
|
|
MONGODB_HOST = os.getenv("MONGODB_HOST") |
|
|
|
|
if not MONGODB_HOST: |
|
|
|
|
raise ValueError("No MONGODB_HOST specified") |
|
|
|
|
|
|
|
|
|
PROMETHEUS_BEARER_TOKEN = os.getenv("PROMETHEUS_BEARER_TOKEN") |
|
|
|
|
if not PROMETHEUS_BEARER_TOKEN: |
|
|
|
@ -16,7 +16,7 @@ app = Sanic("exporter") |
|
|
|
|
|
|
|
|
|
@app.listener("before_server_start") |
|
|
|
|
async def setup_db(app, loop): |
|
|
|
|
app.ctx.db = AsyncIOMotorClient(MONGO_URI).get_default_database() |
|
|
|
|
app.ctx.db = AsyncIOMotorClient(MONGODB_HOST).get_default_database() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def wrap(i, prefix="wildduck_"): |
|
|
|
|