@@ -76,26 +76,22 @@ pub async fn start_rental(
7676 // Get user ID from auth context (already extracted via Extension)
7777 let user_id = & auth_context. user_id ;
7878
79- // Look up user's registered SSH key from database (only if SSH is enabled)
80- let ssh_public_key: String = if request. no_ssh {
81- String :: new ( ) // Empty string for no-SSH rentals
82- } else {
83- let ssh_key_row = sqlx:: query ( "SELECT public_key FROM ssh_keys WHERE user_id = $1" )
84- . bind ( user_id)
85- . fetch_optional ( & state. db )
86- . await
87- . map_err ( |e| crate :: error:: ApiError :: Internal {
88- message : format ! ( "Failed to lookup SSH key: {}" , e) ,
89- } ) ?;
79+ // Look up user's registered SSH key from database
80+ let ssh_key_row = sqlx:: query ( "SELECT public_key FROM ssh_keys WHERE user_id = $1" )
81+ . bind ( user_id)
82+ . fetch_optional ( & state. db )
83+ . await
84+ . map_err ( |e| crate :: error:: ApiError :: Internal {
85+ message : format ! ( "Failed to lookup SSH key: {}" , e) ,
86+ } ) ?;
9087
91- match ssh_key_row {
92- Some ( row) => row. get ( "public_key" ) ,
93- None => {
94- error ! ( "User {} has no SSH key registered" , user_id) ;
95- return Err ( crate :: error:: ApiError :: BadRequest {
96- message : "No SSH key registered. Please register an SSH key first using 'basilica ssh-keys add' or by starting a rental through the CLI." . into ( ) ,
97- } ) ;
98- }
88+ let ssh_public_key: String = match ssh_key_row {
89+ Some ( row) => row. get ( "public_key" ) ,
90+ None => {
91+ error ! ( "User {} has no SSH key registered" , user_id) ;
92+ return Err ( crate :: error:: ApiError :: BadRequest {
93+ message : "No SSH key registered. Please register an SSH key first using 'basilica ssh-keys add' or by starting a rental through the CLI." . into ( ) ,
94+ } ) ;
9995 }
10096 } ;
10197
@@ -242,7 +238,6 @@ pub async fn start_rental(
242238 resources : request. resources ,
243239 command : request. command ,
244240 volumes : request. volumes ,
245- no_ssh : request. no_ssh ,
246241 } ;
247242 debug ! ( "Starting rental with request: {:?}" , validator_request) ;
248243
0 commit comments