@@ -329,17 +329,9 @@ def process_config(
329329 if data .get ("database_url" ) is not None and data ["database_url" ] != "" :
330330 # Parse the db string and check required fields
331331 assert data ["database_url" ] is not None
332+ assert is_valid_database_url (data ["database_url" ])
333+
332334 url = make_url (data ["database_url" ])
333- required_fields = [
334- ("username" , "Username must be specified in the connection URL" ),
335- ("password" , "Password must be specified in the connection URL" ),
336- ("host" , "Host must be specified in the connection URL" ),
337- ("database" , "Database name must be specified in the connection URL" ),
338- ]
339- for field_name , error_message in required_fields :
340- field_value = getattr (url , field_name , None )
341- if not field_value :
342- raise DBOSInitializationError (error_message )
343335
344336 if not data ["database" ].get ("sys_db_name" ):
345337 assert url .database is not None
@@ -385,6 +377,9 @@ def process_config(
385377 if not silent and logs ["logLevel" ] == "INFO" or logs ["logLevel" ] == "DEBUG" :
386378 log_url = make_url (data ["database_url" ]).render_as_string (hide_password = True )
387379 print (f"[bold blue]Using database connection string: { log_url } [/bold blue]" )
380+ print (
381+ f"[bold blue]Database engine parameters: { data ['database' ]['db_engine_kwargs' ]} [/bold blue]"
382+ )
388383
389384 # Return data as ConfigFile type
390385 return data
@@ -432,6 +427,21 @@ def configure_db_engine_parameters(
432427 data ["sys_db_engine_kwargs" ] = system_engine_kwargs
433428
434429
430+ def is_valid_database_url (database_url : str ) -> bool :
431+ url = make_url (database_url )
432+ required_fields = [
433+ ("username" , "Username must be specified in the connection URL" ),
434+ ("password" , "Password must be specified in the connection URL" ),
435+ ("host" , "Host must be specified in the connection URL" ),
436+ ("database" , "Database name must be specified in the connection URL" ),
437+ ]
438+ for field_name , error_message in required_fields :
439+ field_value = getattr (url , field_name , None )
440+ if not field_value :
441+ raise DBOSInitializationError (error_message )
442+ return True
443+
444+
435445def _is_valid_app_name (name : str ) -> bool :
436446 name_len = len (name )
437447 if name_len < 3 or name_len > 30 :
0 commit comments