admin: allow disabling display of metrics

This is useful in situations where the admins of the Snikket
server (i.e. those who care for the docker containers) are not the
same people as the people who are admins of the Snikket service
(i.e. those who care for the users).
This commit is contained in:
Jonas Schäfer
2021-05-27 17:53:42 +02:00
parent 8a293985ca
commit b40a625283
5 changed files with 132 additions and 107 deletions

View File

@@ -160,6 +160,7 @@ class AppConfig:
# Future versions may change this default, and the standard deployment
# tools may also very well override it.
max_avatar_size = environ.var(1024*1024, converter=int)
show_metrics = environ.bool_var(True)
_UPPER_CASE = "".join(map(chr, range(ord("A"), ord("Z")+1)))
@@ -191,6 +192,7 @@ def create_app() -> quart.Quart:
app.config["AVATAR_CACHE_TTL"] = config.avatar_cache_ttl
app.config["APPLE_STORE_URL"] = config.apple_store_url
app.config["MAX_AVATAR_SIZE"] = config.max_avatar_size
app.config["SHOW_METRICS"] = config.show_metrics
app.context_processor(proc)
app.register_error_handler(