mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: enable GitHub OAuth2 login by default on new deployments (#16662)
Third and final PR to address https://github.com/coder/coder/issues/16230. This PR enables GitHub OAuth2 login by default on new deployments. Combined with https://github.com/coder/coder/pull/16629, this will allow the first admin user to sign up with GitHub rather than email and password. We take care not to enable the default on deployments that would upgrade to a Coder version with this change. To disable the default provider an admin can set the `CODER_OAUTH2_GITHUB_DEFAULT_PROVIDER` env variable to false.
This commit is contained in:
@ -107,3 +107,27 @@ ON CONFLICT (key) DO UPDATE SET value = $2 WHERE site_configs.key = $1;
|
||||
DELETE FROM site_configs
|
||||
WHERE site_configs.key = $1;
|
||||
|
||||
-- name: GetOAuth2GithubDefaultEligible :one
|
||||
SELECT
|
||||
CASE
|
||||
WHEN value = 'true' THEN TRUE
|
||||
ELSE FALSE
|
||||
END
|
||||
FROM site_configs
|
||||
WHERE key = 'oauth2_github_default_eligible';
|
||||
|
||||
-- name: UpsertOAuth2GithubDefaultEligible :exec
|
||||
INSERT INTO site_configs (key, value)
|
||||
VALUES (
|
||||
'oauth2_github_default_eligible',
|
||||
CASE
|
||||
WHEN sqlc.arg(eligible)::bool THEN 'true'
|
||||
ELSE 'false'
|
||||
END
|
||||
)
|
||||
ON CONFLICT (key) DO UPDATE
|
||||
SET value = CASE
|
||||
WHEN sqlc.arg(eligible)::bool THEN 'true'
|
||||
ELSE 'false'
|
||||
END
|
||||
WHERE site_configs.key = 'oauth2_github_default_eligible';
|
||||
|
Reference in New Issue
Block a user