@@ -3,6 +3,14 @@ package caddy_webhook
33import (
44 "context"
55 "fmt"
6+ "io"
7+ "net/http"
8+ "net/url"
9+ "os"
10+ "path/filepath"
11+ "strconv"
12+ "strings"
13+
614 "github.com/WingLim/caddy-webhook/webhooks"
715 "github.com/caddyserver/caddy/v2"
816 "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
@@ -12,13 +20,6 @@ import (
1220 githttp "github.com/go-git/go-git/v5/plumbing/transport/http"
1321 "github.com/go-git/go-git/v5/plumbing/transport/ssh"
1422 "go.uber.org/zap"
15- "io"
16- "net/http"
17- "net/url"
18- "os"
19- "path/filepath"
20- "strconv"
21- "strings"
2223)
2324
2425// Interface guards.
@@ -37,47 +38,47 @@ func init() {
3738// WebHook is the module configuration.
3839type WebHook struct {
3940 // Git repository URL, supported http, https and ssh.
40- Repository string `json:"repo,omitempty"`
41+ Repository string `json:"repo,omitempty"`
4142
4243 // Path to clone and update repository.
43- Path string `json:"path,omitempty"`
44+ Path string `json:"path,omitempty"`
4445
4546 // Branch to pull.
4647 // Default to `main`.
47- Branch string `json:"branch,omitempty"`
48+ Branch string `json:"branch,omitempty"`
4849
4950 // Webhook type.
5051 // Default to `github`.
51- Type string `json:"type,omitempty"`
52+ Type string `json:"type,omitempty"`
5253
5354 // Secret to verify webhook request.
54- Secret string `json:"secret,omitempty"`
55+ Secret string `json:"secret,omitempty"`
5556
5657 // Depth for pull and fetch.
5758 // Default to `0`.
58- Depth string `json:"depth,omitempty"`
59+ Depth string `json:"depth,omitempty"`
5960
6061 // Enable recurse submodules.
61- Submodule bool `json:"submodule,omitempty"`
62+ Submodule bool `json:"submodule,omitempty"`
6263
6364 // Command to run when repo initializes or receive a
6465 // correct webhook request.
65- Command []string `json:"command,omitempty"`
66+ Command []string `json:"command,omitempty"`
6667
6768 // Path of private key, using to access git with ssh.
68- Key string `json:"key,omitempty"`
69+ Key string `json:"key,omitempty"`
6970
7071 // Password of private key.
71- KeyPassword string `json:"key_password,omitempty"`
72+ KeyPassword string `json:"key_password,omitempty"`
7273
7374 // Username for http auth.
74- Username string `json:"username,omitempty"`
75+ Username string `json:"username,omitempty"`
7576
7677 // Password for http auth.
77- Password string `json:"password,omitempty"`
78+ Password string `json:"password,omitempty"`
7879
7980 // GitHub personal access token.
80- Token string `json:"token,omitempty"`
81+ Token string `json:"token,omitempty"`
8182
8283 hook webhooks.HookService
8384 auth transport.AuthMethod
0 commit comments