This commit is contained in:
Lennart J. Kurzweg (Nx2)
2026-03-23 22:06:12 +01:00
parent d55fff9f4a
commit b5a3a63dde
6 changed files with 80 additions and 112 deletions

View File

@@ -1,8 +1,10 @@
package config
import (
"net/url"
"os"
"slices"
"strings"
"gopkg.in/yaml.v3"
)
@@ -46,6 +48,14 @@ type ServerConfig struct {
DefaultClass string `yaml:"default_class"`
}
func (s ServerConfig) BasePath() string {
u, err := url.Parse(s.PublicURL)
if err != nil {
return ""
}
return strings.TrimSuffix(u.Path, "/")
}
type Config struct {
Server ServerConfig `yaml:"server"`
Database DatabaseConfig `yaml:"database"`