Skip to content

Commit d1e6a2e

Browse files
Merge pull request #613 from vshn/fix/forgejo-oauth2
Expose oauth2 client configuration for forgejo
2 parents f33c10d + f562fe6 commit d1e6a2e

File tree

6 files changed

+57
-0
lines changed

6 files changed

+57
-0
lines changed

apis/vshn/v1/dbaas_vshn_forgejo.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ type VSHNForgejoConfig struct {
127127
// https://forgejo.org/docs/latest/admin/config-cheat-sheet/#openid-openid
128128
OpenID map[string]string `json:"openid,omitempty"`
129129

130+
// https://forgejo.org/docs/latest/admin/config-cheat-sheet/#oauth2-oauth2
131+
OAuth2 map[string]string `json:"oauth2,omitempty"`
132+
133+
// https://forgejo.org/docs/latest/admin/config-cheat-sheet/#oauth2-client-oauth2_client
134+
OAuth2Client map[string]string `json:"oauth2_client,omitempty"`
135+
130136
// https://forgejo.org/docs/latest/admin/config-cheat-sheet/#service-service
131137
Service map[string]string `json:"service,omitempty"`
132138

apis/vshn/v1/zz_generated.deepcopy.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crds/vshn.appcat.vshn.io_vshnforgejoes.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4642,6 +4642,16 @@ spec:
46424642
type: string
46434643
description: https://forgejo.org/docs/latest/admin/config-cheat-sheet/#mailer-mailer
46444644
type: object
4645+
oauth2:
4646+
additionalProperties:
4647+
type: string
4648+
description: https://forgejo.org/docs/latest/admin/config-cheat-sheet/#oauth2-oauth2
4649+
type: object
4650+
oauth2_client:
4651+
additionalProperties:
4652+
type: string
4653+
description: https://forgejo.org/docs/latest/admin/config-cheat-sheet/#oauth2-client-oauth2_client
4654+
type: object
46454655
openid:
46464656
additionalProperties:
46474657
type: string

crds/vshn.appcat.vshn.io_xvshnforgejoes.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5368,6 +5368,16 @@ spec:
53685368
type: string
53695369
description: https://forgejo.org/docs/latest/admin/config-cheat-sheet/#mailer-mailer
53705370
type: object
5371+
oauth2:
5372+
additionalProperties:
5373+
type: string
5374+
description: https://forgejo.org/docs/latest/admin/config-cheat-sheet/#oauth2-oauth2
5375+
type: object
5376+
oauth2_client:
5377+
additionalProperties:
5378+
type: string
5379+
description: https://forgejo.org/docs/latest/admin/config-cheat-sheet/#oauth2-client-oauth2_client
5380+
type: object
53715381
openid:
53725382
additionalProperties:
53735383
type: string

pkg/comp-functions/functions/vshnforgejo/deploy_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ func TestDeployment(t *testing.T) {
4949
assert.Equal(t, appName, values["gitea"].(map[string]any)["config"].(map[string]any)["APP_NAME"])
5050
})
5151

52+
t.Run("GivenOAuth2ClientSettings_ExpectInHelmValues", func(t *testing.T) {
53+
svc, comp, secretName := bootstrapTest(t)
54+
assert.NoError(t, addForgejo(context.TODO(), svc, comp, secretName))
55+
56+
release := &xhelmv1.Release{}
57+
assert.NoError(t, svc.GetDesiredComposedResourceByName(release, comp.GetName()))
58+
59+
values := getReleaseValues(t, *release)
60+
config := values["gitea"].(map[string]any)["config"].(map[string]any)
61+
assert.Equal(t, map[string]any{"ENABLE_AUTO_REGISTRATION": "true"}, config["oauth2_client"])
62+
assert.Equal(t, map[string]any{"ENABLE": "true"}, config["oauth2"])
63+
})
64+
5265
t.Run("GivenPlan_ExpectPlanResources", func(t *testing.T) {
5366
const (
5467
plan = "small"

test/functions/vshnforgejo/01_default.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ observed:
3939
ENABLED: "true"
4040
openid:
4141
ENABLE_OPENID_SIGNIN: "false"
42+
oauth2:
43+
ENABLE: "true"
44+
oauth2_client:
45+
ENABLE_AUTO_REGISTRATION: "true"
4246
service:
4347
REGISTER_EMAIL_CONFIRM: "true"
4448
mailer:

0 commit comments

Comments
 (0)