@@ -41,7 +41,6 @@ def _setup_app_from_settings(
4141 # NOTE: keeping imports here to reduce CLI load time
4242 from .application import create_application
4343 from .application_settings_utils import convert_to_app_config
44- from .log import setup_logging
4544
4645 # NOTE: By having an equivalent config allows us
4746 # to keep some of the code from the previous
@@ -50,21 +49,15 @@ def _setup_app_from_settings(
5049 # given configs and changing those would not have
5150 # a meaningful RoI.
5251 config = convert_to_app_config (settings )
53-
54- setup_logging (
55- level = settings .log_level ,
56- slow_duration = settings .AIODEBUG_SLOW_DURATION_SECS ,
57- log_format_local_dev_enabled = settings .WEBSERVER_LOG_FORMAT_LOCAL_DEV_ENABLED ,
58- logger_filter_mapping = settings .WEBSERVER_LOG_FILTER_MAPPING ,
59- tracing_settings = settings .WEBSERVER_TRACING ,
60- )
61-
6252 app = create_application ()
6353 return (app , config )
6454
6555
6656async def app_factory () -> web .Application :
6757 """Created to launch app from gunicorn (see docker/boot.sh)"""
58+ from .application import create_application_auth
59+ from .log import setup_logging
60+
6861 app_settings = ApplicationSettings .create_from_envs ()
6962
7063 _logger .info (
@@ -76,10 +69,17 @@ async def app_factory() -> web.Application:
7669 "Using application factory: %s" , app_settings .WEBSERVER_APP_FACTORY_NAME
7770 )
7871
72+ setup_logging (
73+ level = app_settings .log_level ,
74+ slow_duration = app_settings .AIODEBUG_SLOW_DURATION_SECS ,
75+ log_format_local_dev_enabled = app_settings .WEBSERVER_LOG_FORMAT_LOCAL_DEV_ENABLED ,
76+ logger_filter_mapping = app_settings .WEBSERVER_LOG_FILTER_MAPPING ,
77+ tracing_settings = app_settings .WEBSERVER_TRACING ,
78+ )
79+
7980 if app_settings .WEBSERVER_APP_FACTORY_NAME == "WEBSERVER_AUTHZ_APP_FACTORY" :
80- from .application import create_application_authz
8181
82- app = create_application_authz ()
82+ app = create_application_auth ()
8383 else :
8484 app , _ = _setup_app_from_settings (app_settings )
8585
0 commit comments