Parse secrets from ENV_VAR=SECRET_ID or ENV_VAR=SECRET_ID:VERSION format.
(secrets_string: str | None)
| 72 | |
| 73 | |
| 74 | def parse_secrets(secrets_string: str | None) -> dict[str, dict[str, str]]: |
| 75 | """Parse secrets from ENV_VAR=SECRET_ID or ENV_VAR=SECRET_ID:VERSION format.""" |
| 76 | raw = parse_key_value_pairs(secrets_string) |
| 77 | result: dict[str, dict[str, str]] = {} |
| 78 | for key, spec in raw.items(): |
| 79 | if ":" not in spec: |
| 80 | secret_id, version = spec, "latest" |
| 81 | else: |
| 82 | secret_id, _, version = spec.rpartition(":") |
| 83 | result[key] = {"secret": secret_id, "version": version} |
| 84 | return result |
| 85 | |
| 86 | |
| 87 | def format_env_value(value: Any) -> str: |
no test coverage detected