Python dotenv usage
Context
The SDK is configured through the open_api.ini
file.
The file is parsing within base_client.py
during instantiation of BaseClient
descendants' instances.
There are use cases when it will be nice to have a possibility to configure the SDK by environment variables, for instance, when we use the SDK in CI/CD pipelines or provisioning scripts without usage of open_api.ini
file.
Decision
- Use python-dotenv for config management
Scope
- Replace
open_api.ini
file by.env
file (https://community.opengroup.org/osdu/platform/system/sdks/common-python-sdk/-/blob/master/osdu_api/base_client.py#L30); - Change
__init_
method ofBaseClient
class (https://community.opengroup.org/osdu/platform/system/sdks/common-python-sdk/-/blob/master/osdu_api/base_client.py#L49); - Replace
open_api.ini
file for existing parsers (e.g. WITSML parser)
Optional:
- Add dynamic access to the parameters, i.e. remove explicit initialization of a instance properties and add dynamic access to any of them;