Skip to content

Commit 52ee47f

Browse files
committed
feat: add lazy loading in gcp
1 parent 5cc0089 commit 52ee47f

File tree

1 file changed

+3
-1
lines changed
  • pydantic_settings/sources/providers

1 file changed

+3
-1
lines changed

pydantic_settings/sources/providers/gcp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def __init__(
102102
env_parse_enums: bool | None = None,
103103
secret_client: SecretManagerServiceClient | None = None,
104104
case_sensitive: bool | None = True,
105+
lazy_load: bool | None = None,
105106
) -> None:
106107
# Import Google Packages if they haven't already been imported
107108
if SecretManagerServiceClient is None or Credentials is None or google_auth_default is None:
@@ -131,7 +132,6 @@ def __init__(
131132
self._secret_client = secret_client
132133
else:
133134
self._secret_client = SecretManagerServiceClient(credentials=self._credentials)
134-
135135
super().__init__(
136136
settings_cls,
137137
case_sensitive=case_sensitive,
@@ -140,6 +140,8 @@ def __init__(
140140
env_parse_none_str=env_parse_none_str,
141141
env_parse_enums=env_parse_enums,
142142
)
143+
# Set lazy_load after initialization since GCP-specific feature
144+
self.lazy_load = lazy_load if lazy_load is not None else self.config.get('lazy_load', False)
143145

144146
def _load_env_vars(self) -> Mapping[str, str | None]:
145147
return GoogleSecretManagerMapping(

0 commit comments

Comments
 (0)