mirror of
https://github.com/h44z/wg-portal.git
synced 2025-06-28 01:07:03 +00:00
sanitize external_url, remove trailing slashes
This commit is contained in:
parent
7df4e4b813
commit
ab9995350f
@ -190,6 +190,8 @@ func GetConfig() (*Config, error) {
|
|||||||
return nil, fmt.Errorf("failed to load config from yaml: %w", err)
|
return nil, fmt.Errorf("failed to load config from yaml: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg.Web.Sanitize()
|
||||||
|
|
||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
// WebConfig contains the configuration for the web server.
|
// WebConfig contains the configuration for the web server.
|
||||||
type WebConfig struct {
|
type WebConfig struct {
|
||||||
// RequestLogging enables logging of all HTTP requests.
|
// 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 is the path to the TLS certificate key file.
|
||||||
KeyFile string `yaml:"key_file"`
|
KeyFile string `yaml:"key_file"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *WebConfig) Sanitize() {
|
||||||
|
c.ExternalUrl = strings.TrimRight(c.ExternalUrl, "/")
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user