From 64ddd713589fb1c7e18804fa987cb855cc1c0d5a Mon Sep 17 00:00:00 2001 From: cclohmar Date: Mon, 15 Jun 2026 04:42:05 +0000 Subject: [PATCH] fix(admin): add IMAP and proxy to config, store during install --- install.sh | 5 +++++ src/core/admin/ui.go | 9 ++++++--- src/core/config/config.go | 11 +++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index e29d2af..786c0eb 100755 --- a/install.sh +++ b/install.sh @@ -246,6 +246,11 @@ smtp: username: "${SMTP_USER}" password: "${SMTP_PASS}" from: "${SMTP_USER}" +imap: + host: "${IMAP_HOST}" + port: ${IMAP_PORT} +proxy: + ip: "${PROXY_IP}" session: secret: "${SESSION_KEY}" expiry_minutes: 60 diff --git a/src/core/admin/ui.go b/src/core/admin/ui.go index 1ccddba..b935611 100644 --- a/src/core/admin/ui.go +++ b/src/core/admin/ui.go @@ -82,14 +82,14 @@ func readConfigRaw(path string) rawConfig { cfg["smtp_port"] = getNested(m, "smtp", "port") cfg["smtp_user"] = getNested(m, "smtp", "username") cfg["smtp_pass"] = getNested(m, "smtp", "password") - cfg["imap_host"] = "" // stored in .env only - cfg["imap_port"] = "" // stored in .env only + cfg["imap_host"] = getNested(m, "imap", "host") + cfg["imap_port"] = getNested(m, "imap", "port") cfg["nextwks_url"] = getNested(m, "oidc", "redirect_url") if cfg["nextwks_url"] != "" { cfg["nextwks_url"] = trimSuffix(cfg["nextwks_url"], "/auth/callback") } cfg["auth_url"] = getNested(m, "oidc", "issuer_url") - cfg["proxy_ip"] = "" // stored in .env only + cfg["proxy_ip"] = getNested(m, "proxy", "ip") return cfg } @@ -105,6 +105,9 @@ func writeConfigRaw(path string, r *http.Request) string { setNested(m, r.FormValue("smtp_port"), "smtp", "port") setNested(m, r.FormValue("smtp_user"), "smtp", "username") setNested(m, r.FormValue("smtp_pass"), "smtp", "password") + setNested(m, r.FormValue("imap_host"), "imap", "host") + setNested(m, r.FormValue("imap_port"), "imap", "port") + setNested(m, r.FormValue("proxy_ip"), "proxy", "ip") nextwks := r.FormValue("nextwks_url") if nextwks != "" { setNested(m, nextwks+"/auth/callback", "oidc", "redirect_url") diff --git a/src/core/config/config.go b/src/core/config/config.go index 4999412..21eb4f1 100644 --- a/src/core/config/config.go +++ b/src/core/config/config.go @@ -15,6 +15,8 @@ type Config struct { Authelia AutheliaConfig `yaml:"authelia"` OIDC OIDCConfig `yaml:"oidc"` SMTP SMTPConfig `yaml:"smtp"` + IMAP IMAPConfig `yaml:"imap"` + Proxy ProxyConfig `yaml:"proxy"` Session SessionConfig `yaml:"session"` } @@ -55,6 +57,15 @@ type SMTPConfig struct { From string `yaml:"from"` } +type IMAPConfig struct { + Host string `yaml:"host"` + Port int `yaml:"port"` +} + +type ProxyConfig struct { + IP string `yaml:"ip"` +} + type SessionConfig struct { Secret string `yaml:"secret"` ExpiryMinutes int `yaml:"expiry_minutes"`