Modify sp and services to use the protobuf module

This commit is contained in:
mitchell 2019-07-11 21:02:46 -04:00
parent 66ec035ee0
commit 4fc74b0994
23 changed files with 59 additions and 1025 deletions

View file

@ -7,7 +7,6 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
@ -67,15 +66,15 @@ func (mgr *ConfigManager) OpenConfig() (output string, v *viper.Viper, err error
}
contents, err = decryptConfig(mgr.masterpass, cfg)
if err != nil && err == errConfigDecrypted {
if err == errConfigDecrypted {
configDecrypted = true
} else if err != nil && err.Error() == crypto.ErrAuthenticationFailed.Error() {
return output, nil, errors.New("incorrect masterpass")
} else if err != nil {
return output, nil, err
}
if err = mgr.v.ReadConfig(bytes.NewBuffer(contents)); err != nil && strings.HasPrefix(err.Error(), "While parsing config") {
return output, nil, fmt.Errorf("incorrect master password")
} else if err != nil {
if err = mgr.v.ReadConfig(bytes.NewBuffer(contents)); err != nil {
return output, nil, err
}