aboutsummaryrefslogtreecommitdiffstats
path: root/config/accounts.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/accounts.go')
-rw-r--r--config/accounts.go32
1 files changed, 20 insertions, 12 deletions
diff --git a/config/accounts.go b/config/accounts.go
index 1afa77c4..ac0a5444 100644
--- a/config/accounts.go
+++ b/config/accounts.go
@@ -120,18 +120,7 @@ const (
var Accounts []*AccountConfig
-func parseAccounts(root string, accts []string, filename string) error {
- if filename == "" {
- filename = path.Join(root, "accounts.conf")
- err := checkConfigPerms(filename)
- if errors.Is(err, os.ErrNotExist) {
- // No config triggers account configuration wizard
- return nil
- } else if err != nil {
- return err
- }
- }
-
+func parseAccountsFromFile(root string, accts []string, filename string) error {
log.Debugf("Parsing accounts configuration from %s", filename)
file, err := ini.LoadSources(ini.LoadOptions{
@@ -188,6 +177,25 @@ If you want to disable STARTTLS, append +insecure to the schema.
return nil
}
+func parseAccounts(root string, accts []string, filename string) error {
+ if filename == "" {
+ filename = path.Join(root, "accounts.conf")
+ err := checkConfigPerms(filename)
+ if errors.Is(err, os.ErrNotExist) {
+ // No config triggers account configuration wizard
+ return nil
+ } else if err != nil {
+ return err
+ }
+ }
+
+ if err := parseAccountsFromFile(root, accts, filename); err != nil {
+ return fmt.Errorf("%s: %w", filename, err)
+ }
+
+ return nil
+}
+
func ParseAccountConfig(name string, section *ini.Section) (*AccountConfig, error) {
account := AccountConfig{
Name: name,