Create KUMA stateless service

This commit is contained in:
“Naeel”
2026-08-26 12:40:33 +03:00
commit 749c96e1aa
5 changed files with 219 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import os
from flask import Flask, jsonify
app = Flask(__name__)
VERSION = "0.1.0"
def mariadb_configuration():
return {
"database": os.getenv("MARIADB_DATABASE", "db-kuma"),
"host": os.getenv("MARIADB_HOST", "mariadb"),
"port": int(os.getenv("MARIADB_PORT", "3306")),
"user": os.getenv("MARIADB_USER", "userkuma"),
"passwordConfigured": bool(os.getenv("MARIADB_PASSWORD")),
"version": os.getenv("MARIADB_VERSION", "9.4.0"),
}
@app.get("/")
def index():
return jsonify({
"service": "kuma",
"version": VERSION,
"state": "stateless",
"target": "https://whitelist.nodejsk8s.services.ngcloud.ru/",
"mariadb": mariadb_configuration(),
})
@app.get("/health")
def health():
return jsonify({"ok": True, "version": VERSION})
@app.get("/mariadb")
def mariadb():
return jsonify(mariadb_configuration())
if __name__ == "__main__":
app.run(host="0.0.0.0", port=int(os.getenv("PORT", "5000")))
+1
View File
@@ -0,0 +1 @@
flask