duritong / trocla

A password store for password creation and retrieval
Other
75 stars 18 forks source link

feature request: dummy store #51

Closed scoopex closed 6 years ago

scoopex commented 6 years ago

Trocla should provide a dummy store which accepts but ignores store operations and returns dummy values for any get operation for test automation.

This is useful if you:

It seems that you just have to implement a new store in lib/trocla/stores/.

Do you have any hints?

duritong commented 6 years ago

So trocla supports loading stores, that are external to trocla. See Storage backends. What you need to do:

  1. Write a class that inherits from Trocla::Store and implements all the required methods, as well as the behavior you want. Basically:
    class MyStore < Trocla::Storage
    #your stuff
    end
  2. Store that class e.g. in /etc/trocla/mystore.rb
  3. Your storage configuration then should look like:
    store: MyStore
    store_require: /etc/trocla/mystore.rb

done.

scoopex commented 6 years ago

Thanks, i wrote a trivial dummy store for my purposes. I will test this in my environment.

https://github.com/scoopex/trocla/blob/dummy-store/lib/trocla/stores/dummy.rb

duritong commented 6 years ago

let me know if something doesn't work or if you have improvements regarding the documentation, I would welcome PRs! :-) Otherwise I would close this, as it's all done.