Skip to content

Commit

Permalink
Trim last "/" from WOODPECKER_HOST config (#2538)
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Oct 7, 2023
1 parent 4e0b0bd commit bb17d25
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit bb17d25

Please sign in to comment.