OpenSTEF / openstef-dbc

Provides (company specific) database connector for the OpenSTEF package
Mozilla Public License 2.0
1 stars 7 forks source link

Feature KTPS-1550 decouple configmanager and services #9

Closed bremme closed 2 years ago

bremme commented 2 years ago

In order to be able to use openstf-dbc with a different configuration mechanism the data interface need to be decoupled from the config manager. This PR implements this decoupling.

All other projects that use openstf-dbc need to do the following:

# When calling the database for the first time pass in the configuration:
from openstf_dbc.database import DataBase
# first call needs configuration
db = DataBase(config)

# All other calls don't need configuration
def some_function():
    db = DataBase()

I've chosen for DataBase(config) and DataBase() for simplicity and backwards compatibility. But alternatively more input arguments can be used to be more explicit.

Let me know what you think and if this a good approach for decoupling the data interface (and database) and config manager.

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

85.9% 85.9% Coverage
0.0% 0.0% Duplication