feat: log the OAuth2 provider state and registered apps at startup - #29267
Draft
BobbyHo wants to merge 1 commit into
Draft
feat: log the OAuth2 provider state and registered apps at startup#29267BobbyHo wants to merge 1 commit into
BobbyHo wants to merge 1 commit into
Conversation
Every coder server start logs one info line stating whether the OAuth2 provider is enabled, naming CODER_OAUTH2_PROVIDER_ENABLE. When the provider is disabled and applications are still registered, one warning gives the count and the flag to set. A failed query is logged and does not abort startup. The SpammyLogs test allows two more rows for the new line.
Contributor
Author
|
/coder-agents-review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Fourth of five for PLAT-492. Every
coder serverstart logs whether the OAuth2 provider is enabled, namingCODER_OAUTH2_PROVIDER_ENABLE. If the provider is off but applications are still registered, one warning gives the count and the flag to set.oauth2experiment a no-op with a startup warning.Implementation Details
coderd.LogOAuth2ProviderStatelogsoauth2 provider enabledoroauth2 provider disabledat info with aflagfield.GetOAuth2ProviderAppsunder a system context and warns with the count. A query error is logged at warn and startup continues.cli/server.gocalls it once after the database connects, beforecoderd.New.TestServer/SpammyLogsallows two more rows. The new line wraps to two rows at 80 columns.Tests
TestLogOAuth2ProviderStateruns adbmocktable: enabled, disabled with zero apps, disabled with two apps, and a query error. Each case asserts exactly one info line and the expected warnings.