Skip to content

Extract DatabaseConfig read from env vars into own function.

Alejo Carballude requested to merge feature/read_db_env_vars into develop

Context

Creating a database connection using ign-go without instancing a new server is currently quite hard. Calling InitDbWithCfg requires a configured DatabaseConfig instance. Since applications that use ign-go typically work with env vars, it would make sense to get a configured DatabaseConfig instance from env vars. The only place where you can currently get this is inside the Server.readPropertiesFromEnvVars method, which configures, among other things, the dbConfig property of the server.

Change

This PR extracts the code from the Server.readPropertiesFromEnvVars method as a standalone function GetDatabaseConfigFromEnvVars, so that database connections can be opened without requiring a server.

Other information

This will be used in Cloudsim to create package-specific unit tests.

Additional documentation

Edited by Alejo Carballude

Merge request reports