Skip to content

Commit 63dc6fc

Browse files
committed
siteconfig and deployment config
1 parent 9549df5 commit 63dc6fc

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

coderd/database/queries/siteconfig.sql

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,27 @@ ON CONFLICT (key) DO UPDATE SET value = $2 WHERE site_configs.key = $1;
107107
DELETE FROM site_configs
108108
WHERE site_configs.key = $1;
109109

110+
-- name: GetOAuth2GithubDefaultEligible :one
111+
SELECT
112+
CASE
113+
WHEN value = 'true' THEN TRUE
114+
ELSE FALSE
115+
END
116+
FROM site_configs
117+
WHERE key = 'oauth2_github_default_eligible';
118+
119+
-- name: UpsertOAuth2GithubDefaultEligible :exec
120+
INSERT INTO site_configs (key, value)
121+
VALUES (
122+
'oauth2_github_default_eligible',
123+
CASE
124+
WHEN sqlc.arg(eligible)::bool THEN 'true'
125+
ELSE 'false'
126+
END
127+
)
128+
ON CONFLICT (key) DO UPDATE
129+
SET value = CASE
130+
WHEN sqlc.arg(eligible)::bool THEN 'true'
131+
ELSE 'false'
132+
END
133+
WHERE site_configs.key = 'oauth2_github_default_eligible';

codersdk/deployment.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ type OAuth2GithubConfig struct {
506506
ClientID serpent.String `json:"client_id" typescript:",notnull"`
507507
ClientSecret serpent.String `json:"client_secret" typescript:",notnull"`
508508
DeviceFlow serpent.Bool `json:"device_flow" typescript:",notnull"`
509+
DefaultProvider serpent.Bool `json:"default_provider" typescript:",notnull"`
509510
AllowedOrgs serpent.StringArray `json:"allowed_orgs" typescript:",notnull"`
510511
AllowedTeams serpent.StringArray `json:"allowed_teams" typescript:",notnull"`
511512
AllowSignups serpent.Bool `json:"allow_signups" typescript:",notnull"`
@@ -1583,6 +1584,16 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
15831584
YAML: "deviceFlow",
15841585
Default: "false",
15851586
},
1587+
{
1588+
Name: "OAuth2 GitHub Default Provider",
1589+
Description: "Enable the default GitHub OAuth2 provider managed by Coder.",
1590+
Flag: "oauth2-github-default-provider",
1591+
Env: "CODER_OAUTH2_GITHUB_DEFAULT_PROVIDER",
1592+
Value: &c.OAuth2.Github.DefaultProvider,
1593+
Group: &deploymentGroupOAuth2GitHub,
1594+
YAML: "defaultProvider",
1595+
Default: "true",
1596+
},
15861597
{
15871598
Name: "OAuth2 GitHub Allowed Orgs",
15881599
Description: "Organizations the user must be a member of to Login with GitHub.",

0 commit comments

Comments
 (0)