Skip to content

feat(env): add LookupEnv to Reader interface#72

Merged
reyortiz3 merged 7 commits intomainfrom
feat/config-server-idp-config
Mar 31, 2026
Merged

feat(env): add LookupEnv to Reader interface#72
reyortiz3 merged 7 commits intomainfrom
feat/config-server-idp-config

Conversation

@reyortiz3
Copy link
Copy Markdown
Contributor

@reyortiz3 reyortiz3 commented Mar 30, 2026

Summary

  • Adds LookupEnv(key string) (string, bool) to the env.Reader interface, allowing callers to distinguish an absent variable from one explicitly set to an empty string
  • OSReader already implemented LookupEnv via os.LookupEnv; the method is now part of the contract
  • Regenerates env/mocks/mock_reader.go with the new method

Test plan

  • go test ./env/... passes
  • Mock compiles and MockReader satisfies env.Reader

🤖 Generated with Claude Code

reyortiz3 and others added 5 commits March 30, 2026 17:34
Introduces a new config/server package with LoadIDPConfig to read OIDC
IDP settings (issuer, audience, required scope) from environment
variables. Implements absent-vs-empty semantics for
CONFIG_SERVER_REQUIRED_SCOPE via an optional lookupEnvReader extension
of env.Reader, as needed by the config server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lookupEnvReader interface and mapReader test double were using Lookupenv
(lowercase e), not matching OSReader.LookupEnv — so production readers
never satisfied the interface. Fixes the method name to LookupEnv.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows *OSReader to satisfy the optional lookupEnvReader interface used
by packages that need absent-vs-empty semantics for environment
variables (e.g. config/server.LoadIDPConfig).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adding LookupEnv to env.Reader removes the need for a private
lookupEnvReader type-assertion in callers. config/server.LoadIDPConfig
and its tests are simplified accordingly, and the mock is regenerated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Will live in the enterprise/private repo instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@reyortiz3 reyortiz3 changed the title feat(config/server): add LoadIDPConfig with unit tests feat(env): add LookupEnv to Reader interface Mar 30, 2026
reyortiz3 and others added 2 commits March 30, 2026 17:53
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers present variable, present-but-empty, and absent variable to
verify absent-vs-empty semantics of the new Reader.LookupEnv method.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@aponcedeleonch aponcedeleonch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@reyortiz3 reyortiz3 merged commit faff956 into main Mar 31, 2026
5 checks passed
@reyortiz3 reyortiz3 deleted the feat/config-server-idp-config branch March 31, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants