Trim last "/" from WOODPECKER_HOST config (#2538)

https://youtu.be/dGwC_AxaWLo?t=770  
( https://youtu.be/dGwC_AxaWLo?t=1020 )
This commit is contained in:
6543 2023-10-07 15:39:19 +02:00 committed by GitHub
parent 4e0b0bd9b6
commit bb17d25963
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,12 +83,6 @@ func run(c *cli.Context) error {
)
}
if strings.HasSuffix(c.String("server-host"), "/") {
log.Fatal().Msg(
"WOODPECKER_HOST must not have trailing slash",
)
}
_forge, err := setupForge(c)
if err != nil {
log.Fatal().Err(err).Msg("")
@ -226,7 +220,7 @@ func run(c *cli.Context) error {
certmagic.DefaultACME.Email = c.String("lets-encrypt-email")
certmagic.DefaultACME.Agreed = true
address, err := url.Parse(c.String("server-host"))
address, err := url.Parse(strings.TrimSuffix(c.String("server-host"), "/"))
if err != nil {
return err
}
@ -328,7 +322,7 @@ func setupEvilGlobals(c *cli.Context, v store.Store, f forge.Forge) {
server.Config.Server.Cert = c.String("server-cert")
server.Config.Server.Key = c.String("server-key")
server.Config.Server.AgentToken = c.String("agent-secret")
serverHost := c.String("server-host")
serverHost := strings.TrimSuffix(c.String("server-host"), "/")
server.Config.Server.Host = serverHost
if c.IsSet("server-webhook-host") {
server.Config.Server.WebhookHost = c.String("server-webhook-host")