@@ -19,8 +19,8 @@ pub struct DeployOpts<'a> {
19
19
pub filter_tags : Option < HashMap < String , String > > ,
20
20
pub build_tags : Option < HashMap < String , String > > ,
21
21
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 > ,
24
24
pub non_interactive : bool ,
25
25
}
26
26
@@ -69,14 +69,15 @@ pub async fn deploy(opts: DeployOpts<'_>) -> Result<Vec<Uuid>> {
69
69
70
70
// Setup function routes
71
71
setup_function_routes (
72
- opts. ctx ,
73
- environment,
74
- & config,
72
+ opts. ctx ,
73
+ environment,
74
+ & config,
75
75
& 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 ?;
80
81
81
82
// Print summary
82
83
print_summary ( opts. ctx , environment) ;
@@ -89,23 +90,23 @@ async fn setup_function_routes(
89
90
environment : & toolchain:: project:: environment:: TEMPEnvironment ,
90
91
config : & config:: Config ,
91
92
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 > ,
94
95
non_interactive : bool ,
95
96
) -> 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
-
108
97
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
+
109
110
// TODO: Convert this in to a shared fn
110
111
// Filter out builds that match the tags
111
112
if let Some ( filter) = & filter_tags {
@@ -204,20 +205,22 @@ async fn setup_function_routes(
204
205
] ;
205
206
206
207
println ! ( ) ;
207
-
208
+
208
209
let choice_index = if non_interactive {
209
210
// 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 ) => {
215
213
println ! ( "Skipping route sync for '{fn_name}' (non-interactive mode)" ) ;
216
214
1 // Keep existing route
217
215
}
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
+ }
221
224
}
222
225
} else {
223
226
// Interactive mode - prompt the user
@@ -304,17 +307,23 @@ async fn setup_function_routes(
304
307
305
308
let choice_index = if non_interactive {
306
309
// 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 ) => {
312
312
println ! ( "Skipping route creation for '{fn_name}' (non-interactive mode)" ) ;
313
313
1 // Skip route creation
314
314
}
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
+ }
318
327
}
319
328
} else {
320
329
// Interactive mode - prompt the user
@@ -436,4 +445,5 @@ async fn create_function_route(
436
445
}
437
446
438
447
Ok ( ( ) )
439
- }
448
+ }
449
+
0 commit comments