mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-29 05:11:04 +00:00
Added Woodpecker Host Config used for Webhooks (#1869)
When SCM and Woodpecker are deployed in the same cluster, I want that SCM requests Woodpecker directly by internal URL. ![Webhook-host-diagram](https://github.com/woodpecker-ci/woodpecker/assets/127358482/c4689d55-839a-4731-95b3-5734ba561e5f) This PR adds optional URL used for Webhook calls.
This commit is contained in:
parent
6ab9f802d1
commit
0c3021473f
5 changed files with 19 additions and 1 deletions
|
@ -45,6 +45,11 @@ var flags = []cli.Flag{
|
|||
Name: "server-host",
|
||||
Usage: "server fully qualified url (<scheme>://<host>)",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
EnvVars: []string{"WOODPECKER_WEBHOOK_HOST"},
|
||||
Name: "server-webhook-host",
|
||||
Usage: "server fully qualified url for forge's Webhooks (<scheme>://<host>)",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
EnvVars: []string{"WOODPECKER_ROOT_URL"},
|
||||
Name: "root-url",
|
||||
|
|
|
@ -341,6 +341,11 @@ func setupEvilGlobals(c *cli.Context, v store.Store, f forge.Forge) {
|
|||
server.Config.Server.Key = c.String("server-key")
|
||||
server.Config.Server.AgentToken = c.String("agent-secret")
|
||||
server.Config.Server.Host = c.String("server-host")
|
||||
if c.IsSet("server-webhook-host") {
|
||||
server.Config.Server.WebhookHost = c.String("server-webhook-host")
|
||||
} else {
|
||||
server.Config.Server.WebhookHost = c.String("server-host")
|
||||
}
|
||||
if c.IsSet("server-dev-oauth-host") {
|
||||
server.Config.Server.OAuthHost = c.String("server-dev-oauth-host")
|
||||
} else {
|
||||
|
|
|
@ -131,6 +131,13 @@ Server fully qualified URL of the user-facing hostname.
|
|||
|
||||
Example: `WOODPECKER_HOST=http://woodpecker.example.org`
|
||||
|
||||
### `WOODPECKER_WEBHOOK_HOST`
|
||||
> Default: value from `WOODPECKER_HOST` config env
|
||||
|
||||
Server fully qualified URL of the Webhook-facing hostname.
|
||||
|
||||
Example: `WOODPECKER_WEBHOOK_HOST=http://woodpecker-server.cicd.svc.cluster.local:8000`
|
||||
|
||||
### `WOODPECKER_SERVER_ADDR`
|
||||
> Default: `:8000`
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ func PostRepo(c *gin.Context) {
|
|||
|
||||
link := fmt.Sprintf(
|
||||
"%s/hook?access_token=%s",
|
||||
server.Config.Server.Host,
|
||||
server.Config.Server.WebhookHost,
|
||||
sig,
|
||||
)
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ var Config = struct {
|
|||
Cert string
|
||||
OAuthHost string
|
||||
Host string
|
||||
WebhookHost string
|
||||
Port string
|
||||
PortTLS string
|
||||
AgentToken string
|
||||
|
|
Loading…
Reference in a new issue