Skip to content

Commit ac97f24

Browse files
committed
feat(cli): accept dynamic gcp project ID from env var during secrets fetch
1 parent dc10839 commit ac97f24

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

airbyte_cdk/cli/airbyte_cdk/_secrets.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
resolve_connector_name_and_directory,
5050
)
5151

52-
AIRBYTE_INTERNAL_GCP_PROJECT = "dataline-integration-testing"
52+
AIRBYTE_GCP_PROJECT_ID = os.environ.get(
53+
"AIRBYTE_GCP_PROJECT_ID",
54+
"dataline-integration-testing",
55+
)
5356
CONNECTOR_LABEL = "connector"
5457
GLOBAL_MASK_KEYS_URL = "https://connectors.airbyte.com/files/registries/v0/specs_secrets_mask.yaml"
5558

@@ -83,8 +86,8 @@ def secrets_cli_group() -> None:
8386
@click.option(
8487
"--gcp-project-id",
8588
type=str,
86-
default=AIRBYTE_INTERNAL_GCP_PROJECT,
87-
help=f"GCP project ID. Defaults to '{AIRBYTE_INTERNAL_GCP_PROJECT}'.",
89+
default=AIRBYTE_GCP_PROJECT_ID,
90+
help=f"GCP project ID. Defaults to '{AIRBYTE_GCP_PROJECT_ID}'.",
8891
)
8992
@click.option(
9093
"--print-ci-secrets-masks",
@@ -95,7 +98,7 @@ def secrets_cli_group() -> None:
9598
)
9699
def fetch(
97100
connector: str | Path | None = None,
98-
gcp_project_id: str = AIRBYTE_INTERNAL_GCP_PROJECT,
101+
gcp_project_id: str = AIRBYTE_GCP_PROJECT_ID,
99102
print_ci_secrets_masks: bool = False,
100103
) -> None:
101104
"""Fetch secrets for a connector from Google Secret Manager.
@@ -205,13 +208,13 @@ def fetch(
205208
@click.option(
206209
"--gcp-project-id",
207210
type=str,
208-
default=AIRBYTE_INTERNAL_GCP_PROJECT,
209-
help=f"GCP project ID. Defaults to '{AIRBYTE_INTERNAL_GCP_PROJECT}'.",
211+
default=AIRBYTE_GCP_PROJECT_ID,
212+
help=f"GCP project ID. Defaults to '{AIRBYTE_GCP_PROJECT_ID}'.",
210213
)
211214
def list_(
212215
connector_name: str | None = None,
213216
connector_directory: Path | None = None,
214-
gcp_project_id: str = AIRBYTE_INTERNAL_GCP_PROJECT,
217+
gcp_project_id: str = AIRBYTE_GCP_PROJECT_ID,
215218
) -> None:
216219
"""List secrets for a connector from Google Secret Manager.
217220
@@ -303,7 +306,7 @@ def _get_secret_url(secret_name: str, gcp_project_id: str) -> str:
303306

304307
def _fetch_secret_handles(
305308
connector_name: str,
306-
gcp_project_id: str = AIRBYTE_INTERNAL_GCP_PROJECT,
309+
gcp_project_id: str = AIRBYTE_GCP_PROJECT_ID,
307310
) -> list["Secret"]: # type: ignore
308311
"""Fetch secrets from Google Secret Manager."""
309312
if not secretmanager:

0 commit comments

Comments
 (0)