summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2023-12-01 12:35:37 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2023-12-01 12:42:41 +0100
commit215e3c2fc0453122b5fefcc7fe39f14797bee17f (patch)
tree0c41a1e56d325365f6da4714cc40b2b99fadf05b
parent1a64f581ae05cd4c3b01cb34771e3d36ef1fc7e8 (diff)
init: filter out GET /scopes/status requests
ogcp.js calls this endpoint very often, which send a request to the ogserver through the REST API. This call is needed because javascript code cannot directly talk to the ogserver since it does not know what the API_KEY is. Add a filter to skip log GET /scopes/status requests. Thanks to DaniGM for helping with this.
-rw-r--r--ogcp/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ogcp/__init__.py b/ogcp/__init__.py
index 58de9a4..a468101 100644
--- a/ogcp/__init__.py
+++ b/ogcp/__init__.py
@@ -17,6 +17,12 @@ app = Flask(__name__)
app.config.from_json(ogcp_cfg_path)
app.secret_key = urandom(16)
+class NoScopeStatus(logging.Filter):
+ def filter(self, record):
+ return 'GET /scopes/status' not in record.getMessage()
+
+logging.getLogger("werkzeug").addFilter(NoScopeStatus())
+
babel = Babel(app)
csrf = CSRFProtect(app)
bootstrap = Bootstrap(app)