@@ -72,6 +72,7 @@ def example():
72
72
73
73
Current services are swagger, request, tracer, metrics
74
74
"""
75
+
75
76
config_resource = CONFIG_BASE
76
77
services : List [str ] = []
77
78
application = Flask
@@ -105,7 +106,9 @@ def init_services(self) -> None:
105
106
"""
106
107
services_resources = ServicesResource ()
107
108
for service_name , service in services_resources .get_services ():
108
- if service_name not in self .services or not getattr (self , service_name , False ):
109
+ if service_name not in self .services or not getattr (
110
+ self , service_name , False
111
+ ):
109
112
self .services .append (service_name )
110
113
setattr (self , service_name , service )
111
114
@@ -150,7 +153,7 @@ def init_logger(self) -> None:
150
153
:return:
151
154
"""
152
155
self .application .logger = logger
153
- os .environ [' WERKZEUG_RUN_MAIN' ] = "true"
156
+ os .environ [" WERKZEUG_RUN_MAIN" ] = "true"
154
157
155
158
formatter = CustomJsonFormatter ()
156
159
formatter .add_service_name (self .application .config ["APP_NAME" ])
@@ -172,11 +175,16 @@ def init_app(self) -> Flask:
172
175
:return: None
173
176
"""
174
177
if self .swagger :
175
- application = self .swagger .init_app (config = self .config .to_flask (), path = self .path )
178
+ application = self .swagger .init_app (
179
+ config = self .config .to_flask (), path = self .path
180
+ )
176
181
else :
177
182
check_package_exists ("flask" )
178
- application = Flask (__name__ , static_folder = os .path .join (self .path , 'static' ),
179
- template_folder = os .path .join (self .path , 'templates' ))
183
+ application = Flask (
184
+ __name__ ,
185
+ static_folder = os .path .join (self .path , "static" ),
186
+ template_folder = os .path .join (self .path , "templates" ),
187
+ )
180
188
181
189
application .root_path = self .path
182
190
@@ -192,8 +200,7 @@ def init_metrics(self) -> None:
192
200
if self .metrics :
193
201
self .application .register_blueprint (self .metrics .metrics_blueprint )
194
202
self .metrics .add_logger_handler (
195
- self .application .logger ,
196
- self .application .config ["APP_NAME" ]
203
+ self .application .logger , self .application .config ["APP_NAME" ]
197
204
)
198
205
self .metrics .monitor (self .application .config ["APP_NAME" ], self .application )
199
206
@@ -230,7 +237,9 @@ def create_app(self) -> Flask:
230
237
231
238
self .init_metrics ()
232
239
233
- logger .debug ("Started app with PyMS and this services: {}" .format (self .services ))
240
+ logger .debug (
241
+ "Started app with PyMS and this services: {}" .format (self .services )
242
+ )
234
243
235
244
return self .application
236
245
0 commit comments