@@ -48,27 +48,13 @@ pub fn setup() -> (Configuration, AppContainer) {
48
48
panic ! ( "Configuration error: {e}" ) ;
49
49
}
50
50
51
- // Initialize services
52
-
53
- let ( stats_event_sender, stats_repository) = statistics:: setup:: factory ( configuration. core . tracker_usage_statistics ) ;
54
- let stats_event_sender = Arc :: new ( stats_event_sender) ;
55
- let stats_repository = Arc :: new ( stats_repository) ;
56
-
57
- let ban_service = Arc :: new ( RwLock :: new ( BanService :: new ( MAX_CONNECTION_ID_ERRORS_PER_IP ) ) ) ;
58
-
59
- let tracker = initialize_globals_and_tracker ( & configuration) ;
51
+ initialize_global_services ( & configuration) ;
60
52
61
53
tracing:: info!( "Configuration:\n {}" , configuration. clone( ) . mask_secrets( ) . to_json( ) ) ;
62
54
63
- (
64
- configuration,
65
- AppContainer {
66
- tracker,
67
- ban_service,
68
- stats_event_sender,
69
- stats_repository,
70
- } ,
71
- )
55
+ let app_container = initialize_app_container ( & configuration) ;
56
+
57
+ ( configuration, app_container)
72
58
}
73
59
74
60
/// checks if the seed is the instance seed in production.
@@ -100,6 +86,25 @@ pub fn initialize_global_services(configuration: &Configuration) {
100
86
initialize_logging ( configuration) ;
101
87
}
102
88
89
+ /// It initializes the stIoC Container.
90
+ #[ instrument( skip( ) ) ]
91
+ pub fn initialize_app_container ( configuration : & Configuration ) -> AppContainer {
92
+ let ( stats_event_sender, stats_repository) = statistics:: setup:: factory ( configuration. core . tracker_usage_statistics ) ;
93
+ let stats_event_sender = Arc :: new ( stats_event_sender) ;
94
+ let stats_repository = Arc :: new ( stats_repository) ;
95
+
96
+ let ban_service = Arc :: new ( RwLock :: new ( BanService :: new ( MAX_CONNECTION_ID_ERRORS_PER_IP ) ) ) ;
97
+
98
+ let tracker = Arc :: new ( initialize_tracker ( configuration) ) ;
99
+
100
+ AppContainer {
101
+ tracker,
102
+ ban_service,
103
+ stats_event_sender,
104
+ stats_repository,
105
+ }
106
+ }
107
+
103
108
/// It initializes the application static values.
104
109
///
105
110
/// These values are accessible throughout the entire application:
0 commit comments