@@ -3,6 +3,14 @@ package caddy_webhook
3
3
import (
4
4
"context"
5
5
"fmt"
6
+ "io"
7
+ "net/http"
8
+ "net/url"
9
+ "os"
10
+ "path/filepath"
11
+ "strconv"
12
+ "strings"
13
+
6
14
"github.com/WingLim/caddy-webhook/webhooks"
7
15
"github.com/caddyserver/caddy/v2"
8
16
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
@@ -12,13 +20,6 @@ import (
12
20
githttp "github.com/go-git/go-git/v5/plumbing/transport/http"
13
21
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
14
22
"go.uber.org/zap"
15
- "io"
16
- "net/http"
17
- "net/url"
18
- "os"
19
- "path/filepath"
20
- "strconv"
21
- "strings"
22
23
)
23
24
24
25
// Interface guards.
@@ -37,47 +38,47 @@ func init() {
37
38
// WebHook is the module configuration.
38
39
type WebHook struct {
39
40
// Git repository URL, supported http, https and ssh.
40
- Repository string `json:"repo,omitempty"`
41
+ Repository string `json:"repo,omitempty"`
41
42
42
43
// Path to clone and update repository.
43
- Path string `json:"path,omitempty"`
44
+ Path string `json:"path,omitempty"`
44
45
45
46
// Branch to pull.
46
47
// Default to `main`.
47
- Branch string `json:"branch,omitempty"`
48
+ Branch string `json:"branch,omitempty"`
48
49
49
50
// Webhook type.
50
51
// Default to `github`.
51
- Type string `json:"type,omitempty"`
52
+ Type string `json:"type,omitempty"`
52
53
53
54
// Secret to verify webhook request.
54
- Secret string `json:"secret,omitempty"`
55
+ Secret string `json:"secret,omitempty"`
55
56
56
57
// Depth for pull and fetch.
57
58
// Default to `0`.
58
- Depth string `json:"depth,omitempty"`
59
+ Depth string `json:"depth,omitempty"`
59
60
60
61
// Enable recurse submodules.
61
- Submodule bool `json:"submodule,omitempty"`
62
+ Submodule bool `json:"submodule,omitempty"`
62
63
63
64
// Command to run when repo initializes or receive a
64
65
// correct webhook request.
65
- Command []string `json:"command,omitempty"`
66
+ Command []string `json:"command,omitempty"`
66
67
67
68
// Path of private key, using to access git with ssh.
68
- Key string `json:"key,omitempty"`
69
+ Key string `json:"key,omitempty"`
69
70
70
71
// Password of private key.
71
- KeyPassword string `json:"key_password,omitempty"`
72
+ KeyPassword string `json:"key_password,omitempty"`
72
73
73
74
// Username for http auth.
74
- Username string `json:"username,omitempty"`
75
+ Username string `json:"username,omitempty"`
75
76
76
77
// Password for http auth.
77
- Password string `json:"password,omitempty"`
78
+ Password string `json:"password,omitempty"`
78
79
79
80
// GitHub personal access token.
80
- Token string `json:"token,omitempty"`
81
+ Token string `json:"token,omitempty"`
81
82
82
83
hook webhooks.HookService
83
84
auth transport.AuthMethod
0 commit comments