@@ -17,6 +17,7 @@ use proptest_derive::Arbitrary;
1717
1818use crate :: api:: runner:: Port ;
1919use crate :: api:: UserPk ;
20+ use crate :: constants:: { NODE_PROVISION_DNS , NODE_RUN_DNS } ;
2021use crate :: enclave:: { self , MachineId } ;
2122
2223pub const DEFAULT_BACKEND_URL : & str = "http://127.0.0.1:3030" ;
@@ -155,6 +156,11 @@ pub struct RunArgs {
155156 #[ argh( option, default = "DEFAULT_RUNNER_URL.to_owned()" ) ]
156157 pub runner_url : String ,
157158
159+ /// the DNS name the node enclave should include in its remote attestation
160+ /// certificate and the client will expect in its connection
161+ #[ argh( option, default = "NODE_RUN_DNS.to_owned()" ) ]
162+ pub node_dns_name : String ,
163+
158164 /// whether to use a mock API client. Only available during development.
159165 #[ argh( switch, short = 'm' ) ]
160166 pub mock : bool ,
@@ -174,6 +180,7 @@ impl Default for RunArgs {
174180 shutdown_after_sync_if_no_activity : false ,
175181 inactivity_timer_sec : 3600 ,
176182 repl : false ,
183+ node_dns_name : NODE_RUN_DNS . to_owned ( ) ,
177184 backend_url : DEFAULT_BACKEND_URL . to_owned ( ) ,
178185 runner_url : DEFAULT_RUNNER_URL . to_owned ( ) ,
179186 mock : false ,
@@ -198,7 +205,9 @@ impl RunArgs {
198205 . arg ( "--backend-url" )
199206 . arg ( & self . backend_url )
200207 . arg ( "--runner-url" )
201- . arg ( & self . runner_url ) ;
208+ . arg ( & self . runner_url )
209+ . arg ( "--node-dns-name" )
210+ . arg ( & self . node_dns_name ) ;
202211
203212 if self . shutdown_after_sync_if_no_activity {
204213 cmd. arg ( "-s" ) ;
@@ -240,7 +249,7 @@ pub struct ProvisionArgs {
240249
241250 /// the DNS name the node enclave should include in its remote attestation
242251 /// certificate and the client will expect in its connection
243- #[ argh( option, default = "String::from( \" provision.lexe.tech \" )" ) ]
252+ #[ argh( option, default = "NODE_PROVISION_DNS.to_owned( )" ) ]
244253 pub node_dns_name : String ,
245254
246255 /// protocol://host:port of the node backend.
@@ -534,7 +543,7 @@ mod test {
534543 fn do_cmd_roundtrip ( path_str : String , cmd1 : & NodeCommand ) {
535544 let path = Path :: new ( & path_str) ;
536545 // Convert to std::process::Command
537- let std_cmd = cmd1. to_cmd ( & path) ;
546+ let std_cmd = cmd1. to_cmd ( path) ;
538547 // Convert to an iterator over &str args
539548 let mut args_iter = std_cmd. get_args ( ) . filter_map ( |s| s. to_str ( ) ) ;
540549 // Pop the first arg which contains the subcommand name e.g. 'run'
@@ -543,7 +552,7 @@ mod test {
543552 let cmd_args: Vec < & str > = args_iter. collect ( ) ;
544553 dbg ! ( & cmd_args) ;
545554 // Deserialize back into struct
546- let cmd2 = NodeCommand :: from_args ( & [ & subcommand] , & cmd_args) . unwrap ( ) ;
555+ let cmd2 = NodeCommand :: from_args ( & [ subcommand] , & cmd_args) . unwrap ( ) ;
547556 // Assert
548557 assert_eq ! ( * cmd1, cmd2) ;
549558 }
@@ -572,6 +581,7 @@ mod test {
572581 repl : false ,
573582 backend_url : "" . into ( ) ,
574583 runner_url : "" . into ( ) ,
584+ node_dns_name : "localhost" . to_owned ( ) ,
575585 mock : true ,
576586 } ) ;
577587 do_cmd_roundtrip ( path_str, & cmd) ;
@@ -595,6 +605,7 @@ mod test {
595605 repl : true ,
596606 backend_url : "" . into ( ) ,
597607 runner_url : "" . into ( ) ,
608+ node_dns_name : "localhost" . to_owned ( ) ,
598609 mock : false ,
599610 } ) ;
600611 do_cmd_roundtrip ( path_str, & cmd) ;
0 commit comments