@@ -324,26 +324,42 @@ async fn handle_post_config<C>(
324324 }
325325 let store = app_state
326326 . namespaces
327- . config_store ( NamespaceName :: from_string ( namespace) ?)
327+ . config_store ( NamespaceName :: from_string ( namespace. clone ( ) ) ?)
328328 . await ?;
329- let mut config = ( * store. get ( ) ) . clone ( ) ;
330- config. block_reads = req. block_reads ;
331- config. block_writes = req. block_writes ;
332- config. block_reason = req. block_reason ;
333- config. allow_attach = req. allow_attach ;
334- config. txn_timeout = req. txn_timeout_s . map ( Duration :: from_secs) ;
329+ let original = ( * store. get ( ) ) . clone ( ) ;
330+ let mut updated = original. clone ( ) ;
331+ updated. block_reads = req. block_reads ;
332+ updated. block_writes = req. block_writes ;
333+ updated. block_reason = req. block_reason ;
334+ updated. allow_attach = req. allow_attach ;
335+ updated. txn_timeout = req. txn_timeout_s . map ( Duration :: from_secs) ;
335336 if let Some ( size) = req. max_db_size {
336- config . max_db_pages = size. as_u64 ( ) / LIBSQL_PAGE_SIZE ;
337+ updated . max_db_pages = size. as_u64 ( ) / LIBSQL_PAGE_SIZE ;
337338 }
338339 if let Some ( url) = req. heartbeat_url {
339- config . heartbeat_url = Some ( Url :: parse ( & url) ?) ;
340+ updated . heartbeat_url = Some ( Url :: parse ( & url) ?) ;
340341 }
341- config . jwt_key = req. jwt_key ;
342+ updated . jwt_key = req. jwt_key ;
342343 if let Some ( mode) = req. durability_mode {
343- config . durability_mode = mode;
344+ updated . durability_mode = mode;
344345 }
345346
346- store. store ( config) . await ?;
347+ store. store ( updated. clone ( ) ) . await ?;
348+ // we better to not log jwt token - so let's explicitly log necessary fields
349+ tracing:: info!(
350+ message = "updated db config" ,
351+ namespace = namespace,
352+ block_writes_before = original. block_writes,
353+ block_writes_after = updated. block_writes,
354+ block_reads_before = original. block_reads,
355+ block_reads_after = updated. block_reads,
356+ allow_attach_before = original. allow_attach,
357+ allow_attach_after = updated. allow_attach,
358+ max_db_pages_before = original. max_db_pages,
359+ max_db_pages_after = updated. max_db_pages,
360+ durability_mode_before = original. durability_mode. to_string( ) ,
361+ durability_mode_after = updated. durability_mode. to_string( ) ,
362+ ) ;
347363
348364 Ok ( ( ) )
349365}
0 commit comments