@@ -58,6 +58,15 @@ fn main() -> Result<(), anyhow::Error> {
58
58
None
59
59
} ;
60
60
61
+ // ANS processor.
62
+ let ans_indexer_config = build_processor_conf (
63
+ "ans_processor
64
+ ans_v1_primary_names_table_handle: temp
65
+ ans_v1_name_records_table_handle: temp
66
+ ans_v2_contract_address: 0x67bf15b3eed0fc62deea9630bbbd1d48842550655140f913699a1ca7e6f727d8" ,
67
+ & maptos_config,
68
+ ) ?;
69
+
61
70
let num_cpus = num_cpus:: get ( ) ;
62
71
let worker_threads = ( num_cpus * RUNTIME_WORKER_MULTIPLIER ) . max ( 16 ) ;
63
72
println ! (
@@ -94,6 +103,7 @@ fn main() -> Result<(), anyhow::Error> {
94
103
set. spawn ( async move { token_indexer_config. run ( ) . await } ) ;
95
104
set. spawn ( async move { tokenv2_indexer_config. run ( ) . await } ) ;
96
105
}
106
+ set. spawn ( async move { ans_indexer_config. run ( ) . await } ) ;
97
107
98
108
while let Some ( res) = set. join_next ( ) . await {
99
109
tracing:: error!( "An Error occurs during indexer execution: {res:?}" ) ;
@@ -122,33 +132,33 @@ fn build_processor_conf(
122
132
. map ( |t| t. parse ( ) . unwrap_or ( 10 ) )
123
133
. unwrap_or ( 10 ) ;
124
134
125
- // If the starting version is not defined, don't put a default value in the conf.
126
- let starting_version_entry = std:: env:: var ( "INDEXER_STARTING_VERSION" )
127
- . map ( |t| t. parse ( ) . unwrap_or ( 0 ) )
128
- . map ( |t| format ! ( "starting_version: {}" , t) )
129
- . unwrap_or ( String :: new ( ) ) ;
130
-
131
135
//create config file
132
- let indexer_config_content = format ! (
136
+ let mut indexer_config_content = format ! (
133
137
"processor_config:
134
138
type: {}
135
139
postgres_connection_string: {}
136
140
indexer_grpc_data_service_address: {}
137
141
indexer_grpc_http2_ping_interval_in_secs: {}
138
142
indexer_grpc_http2_ping_timeout_in_secs: {}
139
143
auth_token: \" {}\"
140
- default_sleep_time_between_request: {}
141
- {}" ,
144
+ default_sleep_time_between_request: {}" ,
142
145
processor_name,
143
146
maptos_config. indexer_processor. postgres_connection_string,
144
147
indexer_grpc_data_service_address,
145
148
maptos_config. indexer. maptos_indexer_grpc_inactivity_timeout,
146
149
maptos_config. indexer. maptos_indexer_grpc_inactivity_ping_interval,
147
150
maptos_config. indexer_processor. indexer_processor_auth_token,
148
151
default_sleep_time_between_request,
149
- starting_version_entry,
150
152
) ;
151
153
154
+ // If the starting version is not defined, don't put a default value in the conf.
155
+ if let Ok ( start_version) = std:: env:: var ( "INDEXER_STARTING_VERSION" ) {
156
+ if let Ok ( start_version) = start_version. parse :: < u64 > ( ) {
157
+ indexer_config_content. push ( '\n' ) ;
158
+ indexer_config_content. push_str ( & format ! ( "starting_version: {}" , start_version) ) ;
159
+ }
160
+ }
161
+
152
162
//let indexer_config_path = dot_movement.get_path().join("indexer_config.yaml");
153
163
let mut output_file = tempfile:: NamedTempFile :: new ( ) ?;
154
164
write ! ( output_file, "{}" , indexer_config_content) ?;
0 commit comments