@@ -19,8 +19,8 @@ pub struct DeployOpts<'a> {
1919	pub  filter_tags :  Option < HashMap < String ,  String > > , 
2020	pub  build_tags :  Option < HashMap < String ,  String > > , 
2121	pub  version :  Option < String > , 
22- 	pub  auto_create_routes :  Option < bool > , 
23- 	pub  auto_sync_routes :  Option < bool > , 
22+ 	pub  skip_route_creation :  Option < bool > , 
23+ 	pub  keep_existing_routes :  Option < bool > , 
2424	pub  non_interactive :  bool , 
2525} 
2626
@@ -69,14 +69,15 @@ pub async fn deploy(opts: DeployOpts<'_>) -> Result<Vec<Uuid>> {
6969
7070	// Setup function routes 
7171	setup_function_routes ( 
72- 		opts. ctx ,   
73- 		environment,   
74- 		& config,   
72+ 		opts. ctx , 
73+ 		environment, 
74+ 		& config, 
7575		& opts. filter_tags , 
76- 		opts. auto_create_routes , 
77- 		opts. auto_sync_routes , 
78- 		opts. non_interactive 
79- 	) . await ?; 
76+ 		opts. skip_route_creation , 
77+ 		opts. keep_existing_routes , 
78+ 		opts. non_interactive , 
79+ 	) 
80+ 	. await ?; 
8081
8182	// Print summary 
8283	print_summary ( opts. ctx ,  environment) ; 
@@ -89,23 +90,23 @@ async fn setup_function_routes(
8990	environment :  & toolchain:: project:: environment:: TEMPEnvironment , 
9091	config :  & config:: Config , 
9192	filter_tags :  & Option < HashMap < String ,  String > > , 
92- 	auto_create_routes :  Option < bool > , 
93- 	auto_sync_routes :  Option < bool > , 
93+ 	skip_route_creation :  Option < bool > , 
94+ 	keep_existing_routes :  Option < bool > , 
9495	non_interactive :  bool , 
9596)  -> Result < ( ) >  { 
96- 	// Determine default hostname based on project & env 
97- 	let  default_hostname = format ! ( 
98- 		"{}-{}.{}" , 
99- 		ctx. project. name_id, 
100- 		environment. slug, 
101- 		ctx. bootstrap
102- 			. domains
103- 			. job
104- 			. as_ref( ) 
105- 			. context( "bootstrap.domains.job" ) ?
106- 	) ; 
107- 
10897	for  ( fn_name,  function)  in  & config. functions  { 
98+ 		// Determine default hostname based on project & env 
99+ 		let  default_hostname = format ! ( 
100+ 			"{}-{}-{fn_name}.{}" , 
101+ 			ctx. project. name_id, 
102+ 			environment. slug, 
103+ 			ctx. bootstrap
104+ 				. domains
105+ 				. job
106+ 				. as_ref( ) 
107+ 				. context( "bootstrap.domains.job" ) ?
108+ 		) ; 
109+ 
109110		// TODO: Convert this in to a shared fn 
110111		// Filter out builds that match the tags 
111112		if  let  Some ( filter)  = & filter_tags { 
@@ -204,20 +205,22 @@ async fn setup_function_routes(
204205			] ; 
205206
206207			println ! ( ) ; 
207- 			 
208+ 
208209			let  choice_index = if  non_interactive { 
209210				// In non-interactive mode, use auto_sync_routes if provided, otherwise sync by default 
210- 				if  let  Some ( auto_sync)  = auto_sync_routes { 
211- 					if  auto_sync { 
212- 						println ! ( "Auto-syncing route configuration for '{fn_name}' (non-interactive mode)" ) ; 
213- 						0  // Sync route with config 
214- 					}  else  { 
211+ 				match  keep_existing_routes { 
212+ 					Some ( true )  => { 
215213						println ! ( "Skipping route sync for '{fn_name}' (non-interactive mode)" ) ; 
216214						1  // Keep existing route 
217215					} 
218- 				}  else  { 
219- 					println ! ( "Auto-syncing route configuration for '{fn_name}' (non-interactive mode)" ) ; 
220- 					0  // Default to sync in non-interactive mode 
216+ 					Some ( false )  => { 
217+ 						println ! ( "Auto-syncing route configuration for '{fn_name}' (non-interactive mode)" ) ; 
218+ 						0  // Sync route with config 
219+ 					} 
220+ 					None  => { 
221+ 						println ! ( "Auto-syncing route configuration for '{fn_name}' (non-interactive mode)" ) ; 
222+ 						0  // Default to sync in non-interactive mode 
223+ 					} 
221224				} 
222225			}  else  { 
223226				// Interactive mode - prompt the user 
@@ -304,17 +307,23 @@ async fn setup_function_routes(
304307
305308			let  choice_index = if  non_interactive { 
306309				// In non-interactive mode, use auto_create_routes if provided, otherwise create by default 
307- 				if  let  Some ( auto_create)  = auto_create_routes { 
308- 					if  auto_create { 
309- 						println ! ( "Auto-creating route for function '{fn_name}' (non-interactive mode)" ) ; 
310- 						0  // Create default route 
311- 					}  else  { 
310+ 				match  skip_route_creation { 
311+ 					Some ( true )  => { 
312312						println ! ( "Skipping route creation for '{fn_name}' (non-interactive mode)" ) ; 
313313						1  // Skip route creation 
314314					} 
315- 				}  else  { 
316- 					println ! ( "Auto-creating route for function '{fn_name}' (non-interactive mode)" ) ; 
317- 					0  // Default to create in non-interactive mode 
315+ 					Some ( false )  => { 
316+ 						println ! ( 
317+ 							"Auto-creating route for function '{fn_name}' (non-interactive mode)" 
318+ 						) ; 
319+ 						0  // Create default route 
320+ 					} 
321+ 					None  => { 
322+ 						println ! ( 
323+ 							"Auto-creating route for function '{fn_name}' (non-interactive mode)" 
324+ 						) ; 
325+ 						0  // Default to create in non-interactive mode 
326+ 					} 
318327				} 
319328			}  else  { 
320329				// Interactive mode - prompt the user 
@@ -436,4 +445,5 @@ async fn create_function_route(
436445	} 
437446
438447	Ok ( ( ) ) 
439- } 
448+ } 
449+ 
0 commit comments