summary refs log tree commit diff stats
path: root/config/config.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-22 11:35:55 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-22 11:35:55 -0400
commit9b19e3ad054132fdab4062915f70122faaa5c163 (patch)
tree4a41b871550f6fd692711a56aa9b2b7898c8c8f2 /config/config.go
parent1a45b793c7d1d59e209be3eb4b4f794a78085e5d (diff)
downloadaerc-9b19e3ad054132fdab4062915f70122faaa5c163.tar.gz
Show account wizard if no accounts configured
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/config/config.go b/config/config.go
index c6136cf..1019297 100644
--- a/config/config.go
+++ b/config/config.go
@@ -100,7 +100,8 @@ func mapName(raw string) string {
 func loadAccountConfig(path string) ([]AccountConfig, error) {
 	file, err := ini.Load(path)
 	if err != nil {
-		return nil, err
+		// No config triggers account configuration wizard
+		return nil, nil
 	}
 	file.NameMapper = mapName
 
@@ -153,10 +154,6 @@ func loadAccountConfig(path string) ([]AccountConfig, error) {
 
 		accounts = append(accounts, account)
 	}
-	if len(accounts) == 0 {
-		err = errors.New("No accounts configured in accounts.conf")
-		return nil, err
-	}
 	return accounts, nil
 }
 
@@ -359,7 +356,7 @@ func LoadConfig(root *string) (*AercConfig, error) {
 func checkConfigPerms(filename string) error {
 	info, err := os.Stat(filename)
 	if err != nil {
-		return err
+		return nil // disregard absent files
 	}
 	perms := info.Mode().Perm()
 	goPerms := perms >> 3