File tree 2 files changed +29
-2
lines changed
2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,15 @@ pub fn command() -> Command {
128
128
. required ( false )
129
129
. num_args ( 1 ) ,
130
130
)
131
+ . arg (
132
+ Arg :: new ( "KEYS_FILE_CHUNKS" )
133
+ . long ( "keys-file-chunks" )
134
+ . help ( "Sets the number of keys-file chunks" )
135
+ . required ( false )
136
+ . num_args ( 1 )
137
+ . value_parser ( value_parser ! ( usize ) )
138
+ . default_value ( "1" ) ,
139
+ )
131
140
132
141
// optional for cross-account grants
133
142
. arg (
@@ -184,6 +193,7 @@ pub async fn execute(
184
193
key_name_prefix : & str ,
185
194
keys : usize ,
186
195
keys_file_output : & str ,
196
+ keys_file_chunks : usize ,
187
197
grantee_principal : & str ,
188
198
evm_chain_rpc_url : & str ,
189
199
evm_funding_hotkey : & str ,
@@ -385,5 +395,19 @@ pub async fn execute(
385
395
let keys = Keys ( entries) ;
386
396
keys. sync ( keys_file_output) ?;
387
397
398
+ if keys_file_chunks > 1 {
399
+ execute ! (
400
+ stdout( ) ,
401
+ SetForegroundColor ( Color :: Green ) ,
402
+ Print ( format!( "\n Wrote keys in chunk\n " , ) ) ,
403
+ ResetColor
404
+ ) ?;
405
+ for ( cursor, chunk) in keys. 0 . chunks ( keys_file_chunks) . enumerate ( ) {
406
+ let chunk_file_output_path = format ! ( "{keys_file_output}.{}.yaml" , cursor + 1 ) ;
407
+ let chunk_keys = Keys ( chunk. to_vec ( ) ) ;
408
+ chunk_keys. sync ( & chunk_file_output_path) ?;
409
+ }
410
+ }
411
+
388
412
Ok ( ( ) )
389
413
}
Original file line number Diff line number Diff line change @@ -59,7 +59,6 @@ async fn main() -> io::Result<()> {
59
59
} else {
60
60
id_manager:: time:: with_prefix ( "avalanche-kms" )
61
61
} ;
62
- let keys = sub_matches. get_one :: < usize > ( "KEYS" ) . unwrap_or ( & 0 ) . clone ( ) ;
63
62
64
63
let grantee_principal = sub_matches
65
64
. get_one :: < String > ( "GRANTEE_PRINCIPAL" )
@@ -115,8 +114,12 @@ async fn main() -> io::Result<()> {
115
114
. clone ( ) ,
116
115
& sub_matches. get_one :: < String > ( "REGION" ) . unwrap ( ) . clone ( ) ,
117
116
& key_name_prefix,
118
- keys ,
117
+ sub_matches . get_one :: < usize > ( "KEYS" ) . unwrap_or ( & 1 ) . clone ( ) ,
119
118
& keys_file_output,
119
+ sub_matches
120
+ . get_one :: < usize > ( "KEYS_FILE_CHUNKS" )
121
+ . unwrap_or ( & 1 )
122
+ . clone ( ) ,
120
123
& grantee_principal,
121
124
& evm_chain_rpc_url,
122
125
& evm_funding_hotkey,
You can’t perform that action at this time.
0 commit comments