-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expose GCP Secret Manager case sensitive option #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose GCP Secret Manager case sensitive option #626
Conversation
@@ -37,26 +37,34 @@ class GoogleSecretManagerMapping(Mapping[str, Optional[str]]): | |||
_loaded_secrets: dict[str, str | None] | |||
_secret_client: SecretManagerServiceClient | |||
|
|||
def __init__(self, secret_client: SecretManagerServiceClient, project_id: str) -> None: | |||
def __init__(self, secret_client: SecretManagerServiceClient, project_id: str, case_sensitive: bool) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to define a default value for case_sensitive
for backward compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users should never be instantiating this class directly. The GoogleSecretManagerMapping
class is only instantiated internally within the GoogleSecretManagerSettingsSource
class.
I added a default value to the new case_sensitive
parameter of that class which will carry through to here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bellmatthewf - That makes sense to me.
Thanks @bellmatthewf for this PR. @ezwiefel Can you take a look at this PR? |
@@ -37,26 +37,34 @@ class GoogleSecretManagerMapping(Mapping[str, Optional[str]]): | |||
_loaded_secrets: dict[str, str | None] | |||
_secret_client: SecretManagerServiceClient | |||
|
|||
def __init__(self, secret_client: SecretManagerServiceClient, project_id: str) -> None: | |||
def __init__(self, secret_client: SecretManagerServiceClient, project_id: str, case_sensitive: bool) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bellmatthewf - That makes sense to me.
@hramezani LGTM |
Thanks @bellmatthewf for the PR and @ezwiefel for review. |
Issue 625
Issue
The "pydantic-settings[gcp-secret-manager]" integration does not expose the case_sensitive parameter in it's API. It defaults to True and cannot be changed.
Note on changes
I considered using the
parse_env_vars
util function to keep this source in line with others, but that function isn't ideal here because it would iteratively call the GCP API during instantiation to get each variable value.Better to keep those calls lazy by implementing case sensitivity changes at the mapping class level