app-common-python is a simple client access library designed to retrieve configuration for applications running within the Red Hat OpenShift Clowder operator environment. It provides Python wrappers and helper functions to easily access details related to Kafka topics, RDS certificate authorities, Kafka broker servers, object storage buckets, and other service dependency endpoints, abstracting away the underlying JSON configuration provided by Clowder. The current version is 0.2.9, with releases occurring periodically to update schemas and introduce new features.
pip install app-common-pythonVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use `LoadedConfig` and `isClowderEnabled` to access application configuration provided by the Clowder operator. It includes examples for checking the Clowder environment, retrieving a public port, and accessing Kafka server and topic details.
Ensure your application is deployed within a Clowder-managed OpenShift environment or provide a mock configuration if testing locally (e.g., via `ACG_CONFIG` environment variable).
Thoroughly review your Clowder `ClowdApp` and `ClowdEnvironment` definitions to ensure all required configuration keys are present and correctly structured for your application. Use `hasattr(LoadedConfig, 'attribute_name')` for robustness.
Set the `ACG_CONFIG` environment variable to the path of a valid Clowder-compatible JSON configuration file for local development or testing. Example: `export ACG_CONFIG="./test.json"`.
Install the package using `pip install app-common-python`. Double-check the import statement: `from app_common_python import LoadedConfig`.
Verify that your application's `ClowdApp` configuration in OpenShift explicitly defines a public port. If running locally, ensure `ACG_CONFIG` is set and points to a valid JSON file containing the `PublicPort` entry. Always check `if hasattr(LoadedConfig, 'PublicPort'):` before accessing such attributes.
Ensure the Kafka topic is correctly configured and referenced by its `requestedName` in your Clowder `ClowdApp` resource. Access Kafka topics robustly using `if 'my-topic' in LoadedConfig.KafkaTopics:`.
No dependency data recorded yet.