Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: implement yaml parsing for external auth configs#11268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 5 commits intomainfromstevenmasley/yaml_ext_auth
Dec 19, 2023

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedDec 18, 2023
edited
Loading

What this does

Allows user to configure external auths from a yaml file.

@EmyrkEmyrk marked this pull request as ready for reviewDecember 18, 2023 23:05
@EmyrkEmyrk changed the titlechore: yaml parsing for external auth configschore: implement yaml parsing for external auth configsDec 18, 2023
Comment on lines +295 to +313
githubCfg := codersdk.ExternalAuthConfig{
Type: "github",
ClientID: "client_id",
ClientSecret: "client_secret",
ID: "id",
AuthURL: "https://example.com/auth",
TokenURL: "https://example.com/token",
ValidateURL: "https://example.com/validate",
AppInstallURL: "https://example.com/install",
AppInstallationsURL: "https://example.com/installations",
NoRefresh: true,
Scopes: []string{"user:email", "read:org"},
ExtraTokenKeys: []string{"extra", "token"},
DeviceFlow: true,
DeviceCodeURL: "https://example.com/device",
Regex: "^https://example.com/.*$",
DisplayName: "GitHub",
DisplayIcon: "/static/icons/github.svg",
}
Copy link
Member

Choose a reason for hiding this comment

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

Instead of hard-coding this and having to keep it in sync with the golden file, how about marshalling and unmarshalling the config to/from YAML and asserting that the two are the same byte-for-byte?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I can do both, but I should still have the golden file imo. The actual struct isclibase.Struct[[]ExternalAuthConfig]. So it might unmarshal/marshal, but the nested key structure could be messed up. We want to make sure the actual Go slice type is at the right yaml level (top level) imo.

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

This looks OK to me, but I'm by no means the authority on using YAML config.

@EmyrkEmyrkenabled auto-merge (squash)December 19, 2023 16:56
@EmyrkEmyrk merged commitc1451ca intomainDec 19, 2023
@EmyrkEmyrk deleted the stevenmasley/yaml_ext_auth branchDecember 19, 2023 18:09
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsDec 19, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@ammarioammarioAwaiting requested review from ammario

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Emyrk@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp