mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-15 10:57:58 +00:00
feat(ingest): support __from_env__
special server value (#11569)
This commit is contained in:
parent
50929ce212
commit
e5643d56c6
@ -84,6 +84,13 @@ def _get_config_from_env() -> Tuple[Optional[str], Optional[str]]:
|
||||
return url or host, token
|
||||
|
||||
|
||||
def require_config_from_env() -> Tuple[str, Optional[str]]:
|
||||
host, token = _get_config_from_env()
|
||||
if host is None:
|
||||
raise MissingConfigError("No GMS host was provided in env variables.")
|
||||
return host, token
|
||||
|
||||
|
||||
def load_client_config() -> DatahubClientConfig:
|
||||
gms_host_env, gms_token_env = _get_config_from_env()
|
||||
if gms_host_env:
|
||||
|
@ -76,6 +76,12 @@ class DataHubRestEmitter(Closeable, Emitter):
|
||||
):
|
||||
if not gms_server:
|
||||
raise ConfigurationError("gms server is required")
|
||||
if gms_server == "__from_env__" and token is None:
|
||||
# HACK: similar to what we do with system auth, we transparently
|
||||
# inject the config in here. Ideally this should be done in the
|
||||
# config loader or by the caller, but it gets the job done for now.
|
||||
gms_server, token = config_utils.require_config_from_env()
|
||||
|
||||
self._gms_server = fixup_gms_url(gms_server)
|
||||
self._token = token
|
||||
self.server_config: Dict[str, Any] = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user