Skip to content
Snippets Groups Projects
Commit 9cbbb5cb authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Remove passwords when displaying settings

parent d8cdcf5e
No related branches found
No related tags found
No related merge requests found
...@@ -83,9 +83,14 @@ def create_app(config=None): ...@@ -83,9 +83,14 @@ def create_app(config=None):
handler.setLevel(logging.DEBUG) handler.setLevel(logging.DEBUG)
app.logger.addHandler(handler) app.logger.addHandler(handler)
app.logger.info('CSEntry created!') app.logger.info('CSEntry created!')
app.logger.info('Settings:\n{}'.format( # Remove variables that contain a password
'\n'.join(['{}: {}'.format(key, value) for key, value in app.config.items() settings_to_display = [f'{key}: {value}' for key, value in app.config.items()
if key not in ('SECRET_KEY', 'LDAP_BIND_USER_PASSWORD')]))) if key not in ('SECRET_KEY', 'LDAP_BIND_USER_PASSWORD',
'MAIL_CREDENTIALS', 'SQLALCHEMY_DATABASE_URI')]
# The repr() of make_url hides the password
settings_to_display.append(f'SQLALCHEMY_DATABASE_URI: {sa.engine.url.make_url(app.config["SQLALCHEMY_DATABASE_URI"])!r}')
settings_string = '\n'.join(settings_to_display)
app.logger.info(f'Settings:\n{settings_string}')
bootstrap.init_app(app) bootstrap.init_app(app)
db.init_app(app) db.init_app(app)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment