minor refactor

This commit is contained in:
A.Unger
2020-01-31 13:25:51 +01:00
parent 351694d22d
commit 587a6a1a02
2 changed files with 8 additions and 7 deletions
-1
View File
@@ -19,7 +19,6 @@ type Service struct{}
// Set implements the SettingsServiceHandler interface generated on accounts.pb.micro.go
func (s Service) Set(c context.Context, req *proto.Record, res *proto.Record) error {
// TODO this should be a globally initialized struct
st := store.New()
settingsJSON, err := json.Marshal(req.Payload)
+8 -6
View File
@@ -23,16 +23,18 @@ type Store struct {
// New returns a new file system store manager
// TODO add mountPath as a flag. Accept a *config argument
func New() Store {
store := Store{
logger: olog.NewLogger(),
}
// default to the current working directory if not configured
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
// TODO log error
// TODO deal with this
}
return Store{
mountPath: dir,
logger: olog.NewLogger(),
store.logger.Err(err).Msg("initializing the accounts store")
}
store.mountPath = dir
return store
}
// Init implements the store interface