diff options
author | Johannes Thyssen Tishman <johannes@thyssentishman.com> | 2024-04-12 17:23:18 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-04-13 21:47:35 +0200 |
commit | c6a8071f835b01e2385302ecb52e130754496c76 (patch) | |
tree | c145486b46e9cec607f26396934a792711cbd5e5 | |
parent | 06da99cc27bd3bf3288f72d6d223ad334cdcc639 (diff) | |
download | aerc-c6a8071f835b01e2385302ecb52e130754496c76.tar.gz aerc-c6a8071f835b01e2385302ecb52e130754496c76.zip |
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>
-rw-r--r-- | config/accounts.go | 7 | ||||
-rw-r--r-- | doc/aerc-accounts.5.scd | 9 |
2 files changed, 13 insertions, 3 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 { diff --git a/doc/aerc-accounts.5.scd b/doc/aerc-accounts.5.scd index d735e45c..14502409 100644 --- a/doc/aerc-accounts.5.scd +++ b/doc/aerc-accounts.5.scd @@ -17,9 +17,12 @@ be executed automatically on first startup. This file is written in the ini format where each *[section]* is the name of an account you want to configure, and the keys & values in that section specify -details of that account's configuration. In addition to the options documented -here, specific transports for incoming and outgoing emails may have additional -configuration parameters, documented on their respective man pages. +details of that account's configuration. Global options may be configured by +placing them at the top of the file, before any account-specific sections. These +can be overridden for an account by specifying them again in the account +section. In addition to the options documented here, specific transports for +incoming and outgoing emails may have additional configuration parameters, +documented on their respective man pages. # CONFIGURATION |