1
1
use aptos_indexer_processor_sdk:: server_framework:: RunnableConfig ;
2
2
use godfig:: { backend:: config_file:: ConfigFile , Godfig } ;
3
- use maptos_execution_util :: config :: Config ;
3
+ use movement_config :: Config ;
4
4
use movement_health:: run_service;
5
5
use movement_tracing:: simple_metrics:: start_metrics_server;
6
6
use processor_v2:: config:: indexer_processor_config:: IndexerProcessorConfig ;
@@ -13,25 +13,21 @@ fn main() -> Result<(), anyhow::Error> {
13
13
let runtime = get_maptos_runtime ( ) ;
14
14
15
15
runtime. block_on ( async move {
16
- let maptos_config = load_maptos_config ( ) . await . expect ( "Failed to load maptos config" ) ;
17
- let runnable_processor_config : IndexerProcessorConfig =
18
- maptos_config . indexer_processor_v2 . clone ( ) . into ( ) ;
19
-
16
+ let config = load_maptos_config ( ) . await . expect ( "Failed to load maptos config" ) ;
17
+ let indexer_config = config . execution_config . maptos_config . indexer_processor_v2 ;
18
+ let runnable_processor_config : IndexerProcessorConfig = indexer_config . clone ( ) . into ( ) ;
19
+ let metrics_config = indexer_config . metrics_config . clone ( ) ;
20
20
let metrics_handle = tokio:: spawn ( async move {
21
- let res = start_metrics_server (
22
- maptos_config. indexer_processor_v2 . metrics_config . listen_hostname ,
23
- maptos_config. indexer_processor_v2 . metrics_config . listen_port ,
24
- )
25
- . await ;
21
+ let res =
22
+ start_metrics_server ( metrics_config. listen_hostname , metrics_config. listen_port )
23
+ . await ;
26
24
tracing:: info!( "Metrics server started: {:?}" , res) ;
27
25
res
28
26
} ) ;
27
+
28
+ let health_config = indexer_config. health_config . clone ( ) ;
29
29
let health_handle = tokio:: spawn ( async move {
30
- let res = run_service (
31
- maptos_config. indexer_processor_v2 . health_config . hostname ,
32
- maptos_config. indexer_processor_v2 . health_config . port ,
33
- )
34
- . await ;
30
+ let res = run_service ( health_config. hostname , health_config. port ) . await ;
35
31
tracing:: info!( "Health server started: {:?}" , res) ;
36
32
res
37
33
} ) ;
@@ -94,13 +90,12 @@ async fn load_maptos_config() -> anyhow::Result<Config> {
94
90
// get the config file
95
91
let dot_movement = dot_movement:: DotMovement :: try_from_env ( ) ?;
96
92
97
- // Load Maptos config
98
- let maptos_config = {
93
+ // Load config
94
+ let config = {
99
95
let config_file = dot_movement. try_get_or_create_config_file ( ) . await ?;
100
- let godfig: Godfig < maptos_execution_util:: config:: Config , ConfigFile > =
101
- Godfig :: new ( ConfigFile :: new ( config_file) , vec ! [ "maptos_config" . to_string( ) ] ) ;
96
+ let godfig: Godfig < Config , ConfigFile > = Godfig :: new ( ConfigFile :: new ( config_file) , vec ! [ ] ) ;
102
97
godfig. try_wait_for_ready ( ) . await
103
98
} ?;
104
99
105
- Ok ( maptos_config )
100
+ Ok ( config )
106
101
}
0 commit comments