fix(admin): add IMAP and proxy to config, store during install
This commit is contained in:
parent
9813124ba7
commit
64ddd71358
3 changed files with 22 additions and 3 deletions
|
|
@ -246,6 +246,11 @@ smtp:
|
||||||
username: "${SMTP_USER}"
|
username: "${SMTP_USER}"
|
||||||
password: "${SMTP_PASS}"
|
password: "${SMTP_PASS}"
|
||||||
from: "${SMTP_USER}"
|
from: "${SMTP_USER}"
|
||||||
|
imap:
|
||||||
|
host: "${IMAP_HOST}"
|
||||||
|
port: ${IMAP_PORT}
|
||||||
|
proxy:
|
||||||
|
ip: "${PROXY_IP}"
|
||||||
session:
|
session:
|
||||||
secret: "${SESSION_KEY}"
|
secret: "${SESSION_KEY}"
|
||||||
expiry_minutes: 60
|
expiry_minutes: 60
|
||||||
|
|
|
||||||
|
|
@ -82,14 +82,14 @@ func readConfigRaw(path string) rawConfig {
|
||||||
cfg["smtp_port"] = getNested(m, "smtp", "port")
|
cfg["smtp_port"] = getNested(m, "smtp", "port")
|
||||||
cfg["smtp_user"] = getNested(m, "smtp", "username")
|
cfg["smtp_user"] = getNested(m, "smtp", "username")
|
||||||
cfg["smtp_pass"] = getNested(m, "smtp", "password")
|
cfg["smtp_pass"] = getNested(m, "smtp", "password")
|
||||||
cfg["imap_host"] = "" // stored in .env only
|
cfg["imap_host"] = getNested(m, "imap", "host")
|
||||||
cfg["imap_port"] = "" // stored in .env only
|
cfg["imap_port"] = getNested(m, "imap", "port")
|
||||||
cfg["nextwks_url"] = getNested(m, "oidc", "redirect_url")
|
cfg["nextwks_url"] = getNested(m, "oidc", "redirect_url")
|
||||||
if cfg["nextwks_url"] != "" {
|
if cfg["nextwks_url"] != "" {
|
||||||
cfg["nextwks_url"] = trimSuffix(cfg["nextwks_url"], "/auth/callback")
|
cfg["nextwks_url"] = trimSuffix(cfg["nextwks_url"], "/auth/callback")
|
||||||
}
|
}
|
||||||
cfg["auth_url"] = getNested(m, "oidc", "issuer_url")
|
cfg["auth_url"] = getNested(m, "oidc", "issuer_url")
|
||||||
cfg["proxy_ip"] = "" // stored in .env only
|
cfg["proxy_ip"] = getNested(m, "proxy", "ip")
|
||||||
return cfg
|
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_port"), "smtp", "port")
|
||||||
setNested(m, r.FormValue("smtp_user"), "smtp", "username")
|
setNested(m, r.FormValue("smtp_user"), "smtp", "username")
|
||||||
setNested(m, r.FormValue("smtp_pass"), "smtp", "password")
|
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")
|
nextwks := r.FormValue("nextwks_url")
|
||||||
if nextwks != "" {
|
if nextwks != "" {
|
||||||
setNested(m, nextwks+"/auth/callback", "oidc", "redirect_url")
|
setNested(m, nextwks+"/auth/callback", "oidc", "redirect_url")
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ type Config struct {
|
||||||
Authelia AutheliaConfig `yaml:"authelia"`
|
Authelia AutheliaConfig `yaml:"authelia"`
|
||||||
OIDC OIDCConfig `yaml:"oidc"`
|
OIDC OIDCConfig `yaml:"oidc"`
|
||||||
SMTP SMTPConfig `yaml:"smtp"`
|
SMTP SMTPConfig `yaml:"smtp"`
|
||||||
|
IMAP IMAPConfig `yaml:"imap"`
|
||||||
|
Proxy ProxyConfig `yaml:"proxy"`
|
||||||
Session SessionConfig `yaml:"session"`
|
Session SessionConfig `yaml:"session"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,6 +57,15 @@ type SMTPConfig struct {
|
||||||
From string `yaml:"from"`
|
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 {
|
type SessionConfig struct {
|
||||||
Secret string `yaml:"secret"`
|
Secret string `yaml:"secret"`
|
||||||
ExpiryMinutes int `yaml:"expiry_minutes"`
|
ExpiryMinutes int `yaml:"expiry_minutes"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue