bluebell/conf/conf.go

27 lines
445 B
Go
Raw Normal View History

2024-08-10 13:28:30 +01:00
package conf
type Conf struct {
Listen string `yaml:"listen"`
2024-08-16 16:48:50 +01:00
DB string `yaml:"db"`
Domain string `yaml:"domain"`
2024-08-10 13:28:30 +01:00
}
2024-08-16 16:48:50 +01:00
func SlugFromDomain(domain string) string {
2024-08-10 13:28:30 +01:00
a := []byte(domain)
for i := range a {
switch {
case a[i] == '-':
// skip
case a[i] >= 'A' && a[i] <= 'Z':
a[i] += 32
case a[i] >= 'a' && a[i] <= 'z':
// skip
case a[i] >= '0' && a[i] <= '9':
// skip
default:
a[i] = '-'
}
}
return string(a)
}