Skip to content

datarobot_genai.drmcp.core.deployment_config

deployment_config

DeploymentConfig

Bases: Enum

Source code in datarobot_genai/drmcp/core/deployment_config.py
class DeploymentConfig(Enum):
    WORKLOAD_ID = auto()
    MLOPS_DEPLOYMENT_ID = auto()
    DATAROBOT_PUBLIC_API_ENDPOINT = auto()
    DATAROBOT_ENDPOINT = auto()
    DR_WORKLOAD_EXTERNAL_URL_HOST = auto()

    def get_from_os_env(self) -> str | None:
        return os.getenv(self.name, "").strip() or None

    @staticmethod
    def get_datarobot_public_api_endpoint() -> str | None:
        """
        ``DATAROBOT_PUBLIC_API_ENDPOINT`` wins over ``DATAROBOT_ENDPOINT``
        An on-prem install commonly points ``DATAROBOT_ENDPOINT`` at an internal
        cluster address. A resource identifier built from it is one no external
        client can reach, and RFC 9728 §7.3 has the client compare the metadata URL
        it fetched against ``resource``, so a wrong value fails discovery outright.

        When neither variable is set this returns ``None`` rather than guessing a
        default host. The value is published as this server's identity, and a
        confidently wrong identity is worse than an absent one.
        """
        return (
            DeploymentConfig.DATAROBOT_PUBLIC_API_ENDPOINT.get_from_os_env()
            or DeploymentConfig.DATAROBOT_ENDPOINT.get_from_os_env()
        )

get_datarobot_public_api_endpoint staticmethod

get_datarobot_public_api_endpoint() -> str | None

DATAROBOT_PUBLIC_API_ENDPOINT wins over DATAROBOT_ENDPOINT An on-prem install commonly points DATAROBOT_ENDPOINT at an internal cluster address. A resource identifier built from it is one no external client can reach, and RFC 9728 §7.3 has the client compare the metadata URL it fetched against resource, so a wrong value fails discovery outright.

When neither variable is set this returns None rather than guessing a default host. The value is published as this server's identity, and a confidently wrong identity is worse than an absent one.

Source code in datarobot_genai/drmcp/core/deployment_config.py
@staticmethod
def get_datarobot_public_api_endpoint() -> str | None:
    """
    ``DATAROBOT_PUBLIC_API_ENDPOINT`` wins over ``DATAROBOT_ENDPOINT``
    An on-prem install commonly points ``DATAROBOT_ENDPOINT`` at an internal
    cluster address. A resource identifier built from it is one no external
    client can reach, and RFC 9728 §7.3 has the client compare the metadata URL
    it fetched against ``resource``, so a wrong value fails discovery outright.

    When neither variable is set this returns ``None`` rather than guessing a
    default host. The value is published as this server's identity, and a
    confidently wrong identity is worse than an absent one.
    """
    return (
        DeploymentConfig.DATAROBOT_PUBLIC_API_ENDPOINT.get_from_os_env()
        or DeploymentConfig.DATAROBOT_ENDPOINT.get_from_os_env()
    )