sanitize external_url, remove trailing slashes

This commit is contained in:
Christoph Haas 2025-05-15 17:58:34 +02:00
parent 7df4e4b813
commit ab9995350f
No known key found for this signature in database
2 changed files with 8 additions and 0 deletions

View File

@ -190,6 +190,8 @@ func GetConfig() (*Config, error) {
return nil, fmt.Errorf("failed to load config from yaml: %w", err)
}
cfg.Web.Sanitize()
return cfg, nil
}

View File

@ -1,5 +1,7 @@
package config
import "strings"
// WebConfig contains the configuration for the web server.
type WebConfig struct {
// RequestLogging enables logging of all HTTP requests.
@ -26,3 +28,7 @@ type WebConfig struct {
// KeyFile is the path to the TLS certificate key file.
KeyFile string `yaml:"key_file"`
}
func (c *WebConfig) Sanitize() {
c.ExternalUrl = strings.TrimRight(c.ExternalUrl, "/")
}