Skip to content

Adding case insensitive option for GCP Secrets Manager #625

@bellmatthewf

Description

@bellmatthewf

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.

/pydantic_settings/sources/providers/gcp.py

class GoogleSecretManagerSettingsSource(EnvSettingsSource):
    def __init__(
        self,
        settings_cls: type[BaseSettings],
        credentials: Credentials | None = None,
        project_id: str | None = None,
        env_prefix: str | None = None,
        env_parse_none_str: str | None = None,
        env_parse_enums: bool | None = None,
        secret_client: SecretManagerServiceClient | None = None,
    ) -> None:
        
        ...

        super().__init__(
            settings_cls,
            case_sensitive=True,
            env_prefix=env_prefix,
            env_ignore_empty=False,
            env_parse_none_str=env_parse_none_str,
            env_parse_enums=env_parse_enums,
        )

I'd like to expose this option this so that I can have a Pydantic model with lower case attributes, but upper case environment variables in GCP Secret Manager without needing to add an alias on every attribute.

I'm happy to put up a PR for this if this makes sense!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions