config_utils
Utility functions for parsing and setting up pod configuration.
Module
Functions
fetch_datasources_from_hub
def fetch_datasources_from_hub( hub: BitfountHub,) ‑> list[DatasourceContainerConfig]:Fetch datasource configurations from the hub compute cluster API.
Arguments
hub: Authenticated hub client, optionally scoped to a compute cluster.
Returns Datasource container configs deserialized from the hub.
load_pod_config
def load_pod_config( path_to_config_yaml: str | PathLike[str] | None = None,) ‑> PodConfig:Load pod configuration from a YAML file and/or environment variables.
If a config file is found it is parsed first, then pod bootstrap settings
from the current pod bootstrap environment variables override matching fields
when set. An optional cluster_id may also be set in the YAML file.
If no config file exists, BITFOUNT_USERNAME is required and
BITFOUNT_CLUSTER_ID is required unless BITFOUNT_API_KEY_ID and
BITFOUNT_API_KEY are set. When no pod name is configured,
the installation UUID is used.
Arguments
path_to_config_yaml: Optional explicit path to a pod config YAML file.
Returns The loaded PodConfig.
Raises
ValueError: If no config file exists and required env vars are missing.
parse_pod_config_file
def parse_pod_config_file( path_to_config_yaml: str | PathLike[str],) ‑> PodConfig:Parses a pod YAML config file into a PodConfig instance.
Arguments
path_to_config_yaml: The path to the config file.
Returns The parsed PodConfig.
parse_pod_config_from_env
def parse_pod_config_from_env() ‑> PodConfig:Build a PodConfig from required pod bootstrap settings.
Returns A PodConfig populated from the current pod bootstrap environment variables.
Raises
ValueError: If any required bootstrap setting is missing.
setup_datasource
def setup_datasource( datasource_config: DatasourceConfig,) ‑> DatasourceContainerConfig:Creates a BaseSource from a DatasourceConfig.
Arguments
datasource_config: The configuration as a DatasourceConfig instance.
Returns The created DatasourceContainerConfig.