email kinda working

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2026-03-30 22:18:58 +02:00
parent 057ba02865
commit ce78c6e07f
6 changed files with 375 additions and 3 deletions

View File

@@ -46,6 +46,7 @@ type DatabaseConfig struct {
type ServerConfig struct {
BindAddress string `yaml:"bind_address"`
PublicURL string `yaml:"public_url"`
EmailDomain string `yaml:"email_domain"`
Redaction string `yaml:"redaction_text"`
DefaultClass string `yaml:"default_class"`
}
@@ -58,9 +59,17 @@ func (s ServerConfig) BasePath() string {
return strings.TrimSuffix(u.Path, "/")
}
type SMTPConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
}
type Config struct {
Server ServerConfig `yaml:"server"`
Database DatabaseConfig `yaml:"database"`
SMTP SMTPConfig `yaml:"smtp"`
Users []User `yaml:"users"`
Calendars []Calendar `yaml:"calendars"`
Aggregates []Aggregate `yaml:"aggregates"`
@@ -100,7 +109,16 @@ func (c *Config) setDefaults() {
if c.Server.DefaultClass == "" {
c.Server.DefaultClass = "CONFIDENTIAL"
}
if c.Server.EmailDomain == "" {
c.Server.EmailDomain = "nx2.site"
}
if c.Database.URL == "" {
c.Database.URL = "postgres://nxcaldav@localhost:5432/nxcaldav?sslmode=disable"
}
if c.SMTP.Host == "" {
c.SMTP.Host = "localhost"
}
if c.SMTP.Port == 0 {
c.SMTP.Port = 25
}
}