Merge pull request #228 from sbraz/docker_debug

Docker: add an environment variable to activate debug logs, fixes #164
This commit is contained in:
Ryan Kelly 2020-09-08 14:49:00 +10:00 committed by GitHub
commit 4fa33bf8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -119,6 +119,7 @@ environment variables, like this::
-e SYNCSERVER_SQLURI=sqlite:////tmp/syncserver.db \
-e SYNCSERVER_BATCH_UPLOAD_ENABLED=true \
-e SYNCSERVER_FORCE_WSGI_ENVIRON=false \
-e SYNCSERVER_DEBUG_ENABLED=true \
-e PORT=5000 \
mozilla/syncserver:latest

View File

@ -143,7 +143,10 @@ def includeme(config):
# Default to basic logging config.
root_logger = logging.getLogger("")
if not root_logger.handlers:
logging.basicConfig(level=logging.WARN)
if settings.get("syncserver.debug_enabled"):
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.WARN)
if "fxa.metrics_uid_secret_key" not in settings:
# Default to a randomly-generated secret.
# This setting isn't useful in a self-hosted setup
@ -191,6 +194,9 @@ def import_settings_from_environment_variables(settings, environ=None):
("SYNCSERVER_BATCH_UPLOAD_ENABLED",
"storage.batch_upload_enabled",
str_to_bool),
("SYNCSERVER_DEBUG_ENABLED",
"syncserver.debug_enabled",
str_to_bool),
)
if "SYNCSERVER_SECRET_FILE" in environ:
settings["syncserver.secret"] = \