list keys working as expected, datastructure not pretty

This commit is contained in:
A.Unger
2020-02-03 14:16:30 +01:00
parent f5ae339125
commit be26b67a0c
6 changed files with 132 additions and 25 deletions
+15 -3
View File
@@ -44,14 +44,26 @@ func New() *Store {
}
// Init implements the store interface
// TODO it could prepare the destination path, for instance
func (s Store) Init(...mstore.Option) error {
return nil
}
// List implements the store interface
// List returns all the identities in the mountPath folder
func (s Store) List() ([]*mstore.Record, error) {
return nil, nil
records := []*mstore.Record{}
identities, err := ioutil.ReadDir(s.mountPath)
if err != nil {
s.Logger.Err(err).Msgf("error reading %v", s.mountPath)
}
s.Logger.Info().Msg("listing identities")
for _, v := range identities {
records = append(records, &mstore.Record{
Key: v.Name(),
})
}
return records, nil
}
// Read implements the store interface