only allow access to metrics from prometheus or local adresses and wireguard vpn connection
Build and Push Docker Container / build-and-push (push) Successful in 4m45s

This commit is contained in:
2026-04-07 01:42:25 +02:00
parent abed259129
commit dfa658e4ce
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -1,3 +1,5 @@
from quart_common.web.decorators import restrict_ip_addresses
from quart import Blueprint, jsonify from quart import Blueprint, jsonify
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@@ -8,6 +10,7 @@ def create_metrics_blueprint(server:'Server') -> Blueprint:
blueprint = Blueprint('metrics', __name__) blueprint = Blueprint('metrics', __name__)
@blueprint.get('/metrics') @blueprint.get('/metrics')
@restrict_ip_addresses(allow=['192.168.188.0/24', '192.168.200.0/24'], abort_code=404)
async def metrics(): async def metrics():
snapshot = await server.metrics_collector.build_snapshot( snapshot = await server.metrics_collector.build_snapshot(
server.game_runtime.game_last_seen_unix, server.game_runtime.game_last_seen_unix,
@@ -16,6 +19,7 @@ def create_metrics_blueprint(server:'Server') -> Blueprint:
return jsonify(snapshot) return jsonify(snapshot)
@blueprint.get('/metrics/prometheus') @blueprint.get('/metrics/prometheus')
@restrict_ip_addresses(allow=['192.168.188.0/24', '192.168.200.0/24'], abort_code=404)
async def metrics_prometheus(): async def metrics_prometheus():
snapshot = await server.metrics_collector.build_snapshot( snapshot = await server.metrics_collector.build_snapshot(
server.game_runtime.game_last_seen_unix, server.game_runtime.game_last_seen_unix,