feat(infrastructure): Introduce shared infrastructure config package.
Add a new infrastructure package that centralises loading of the
infrastructure config and instantiation of the secrets provider, replacing the
per-package loading logic that previously lived in postgres.
infrastructure.DefaultConfig() lazily loads /etc/labkit/infrastructure.yaml
and a file-backed secret provider rooted at /secrets/infrastructure, caching
the result for subsequent callers.
Refactor the PostgreSQL client to consume *infrastructure.Config via a new
WithInfrastructure option, which is primarily useful for testing. When no
config is provided, postgres.New(ctx) falls back to DefaultConfig(), so the
developer-friendly zero-argument API is preserved and LabKit will do the right
thing.
As part of the refactor:
- Replace
ErrUndefinedDependencywith the more specificErrNotConfiguredandErrMissingSecrets. - Move secret lookups from a postgres-specific mount (
/secrets/infrastructure/postgresql) to keyed lookups (postgresql/username,postgresql/password) against the shared provider rooted at/secrets/infrastructure. - Rewrite
postgrestests to construct*infrastructure.Configdirectly with asecret.MemoryProvider, avoiding filesystem fixtures and adding coverage for missing-secret error paths.
Issue: gitlab-com/gl-infra/platform/runway/team#884 (closed)