Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 7c4582e

Browse files
author
Noah Lee
committed
Fix the bug of the InsecureSSL field (#371)
1 parent 797fe9f commit 7c4582e

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Diff for: internal/interactor/repo.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ type (
6262
// the hook ID.
6363
func (i *RepoInteractor) ActivateRepo(ctx context.Context, u *ent.User, r *ent.Repo) (*ent.Repo, error) {
6464
hid, err := i.scm.CreateWebhook(ctx, u, r, &extent.WebhookConfig{
65-
URL: i.WebhookURL,
66-
InsecureSSL: i.WebhookSSL,
67-
Secret: i.WebhookSecret,
65+
URL: i.WebhookURL,
66+
SSL: i.WebhookSSL,
67+
Secret: i.WebhookSecret,
6868
})
6969
if err != nil {
7070
return nil, fmt.Errorf("failed to create a webhook: %s", err)

Diff for: internal/pkg/github/mapper.go

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ func mapGithubBranchToBranch(b *github.Branch) *extent.Branch {
148148
}
149149
}
150150

151+
// mapInsecureSSL returns 0 when verification is performed
152+
// but returns 1 when verification is not performed.
151153
func mapInsecureSSL(ssl bool) int {
152154
if ssl {
153155
return 0

Diff for: internal/pkg/github/repos.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func (g *Github) CreateWebhook(ctx context.Context, u *ent.User, r *ent.Repo, c
250250
"url": c.URL,
251251
"content_type": "json",
252252
"secret": c.Secret,
253-
"insecure_ssl": mapInsecureSSL(c.InsecureSSL),
253+
"insecure_ssl": mapInsecureSSL(c.SSL),
254254
},
255255
Events: []string{"deployment_status", "push"},
256256
Active: github.Bool(true),

Diff for: model/extent/webhook.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package extent
22

33
type (
44
WebhookConfig struct {
5-
URL string
6-
Secret string
7-
InsecureSSL bool
5+
URL string
6+
Secret string
7+
SSL bool
88
}
99
)

0 commit comments

Comments
 (0)