Skip to content

Feature request: allow intercepting or lazily blocking secret fetching in GoogleSecretManagerSettingsSource #713

@fede-bello

Description

@fede-bello

I'm using GoogleSecretManagerSettingsSource, and I would like to lazily load some secrets so they are only fetched when actually accessed. The current implementation fetches every single secret defined in the Settings class from Google Secret Manager during initialization, regardless of whether those secrets will actually be used.

This eager loading is the expected behavior, but it causes some isues:

  • Performance penalty: Each secret fetch is a network call to GCP
  • Unnecessary costs: GCP charges per secret access, so fetching unused secrets wastes money
  • No conditional loading: Can't skip secrets based on environment (dev vs prod) or feature flags

Ideally, the solution would allow the following:

  • Avoid loading all GCP secrets when instantiating a settings object
  • Intercept secret access before calling the GCP API
  • Implement conditional/lazy loading in applications that may not need all settings

For example, in my application some modules use only a subset of settings. Currently, importing the settings class triggers GCP secret access even if the code path will not require those secrets.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions