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.
master
OpenGnSys Support Team 2023-12-01 12:35:37 +01:00
parent 1a64f581ae
commit 215e3c2fc0
1 changed files with 6 additions and 0 deletions

View File

@ -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)