aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorJohannes Thyssen Tishman <johannes@thyssentishman.com>2024-04-12 17:23:18 +0200
committerRobin Jarry <robin@jarry.cc>2024-04-13 21:47:35 +0200
commitc6a8071f835b01e2385302ecb52e130754496c76 (patch)
treec145486b46e9cec607f26396934a792711cbd5e5 /config
parent06da99cc27bd3bf3288f72d6d223ad334cdcc639 (diff)
downloadaerc-c6a8071f835b01e2385302ecb52e130754496c76.tar.gz
config: allow global options in accounts.conf
Global options may be configured by placing them at the top of the accounts.conf file, before any account-specific sections. These can be overridden for an account by specifying them again in the account section. Changelog-added: Set global options in `accounts.conf` by placing them at the top of the file. Signed-off-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config')
-rw-r--r--config/accounts.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/config/accounts.go b/config/accounts.go
index 6e0d6268..f0853ee6 100644
--- a/config/accounts.go
+++ b/config/accounts.go
@@ -132,14 +132,21 @@ func parseAccountsFromFile(root string, accts []string, filename string) error {
}
starttls_warned := false
+ var globals *ini.Section
for _, _sec := range file.SectionStrings() {
if _sec == "DEFAULT" {
+ globals = file.Section(_sec)
continue
}
if len(accts) > 0 && !contains(accts, _sec) {
continue
}
sec := file.Section(_sec)
+ for key, val := range globals.KeysHash() {
+ if !sec.HasKey(key) {
+ _, _ = sec.NewKey(key, val)
+ }
+ }
account, err := ParseAccountConfig(_sec, sec)
if err != nil {