boston-library / curator

Rails API Engine For Replacing Fedora With A more SQL driven approach
MIT License
7 stars 0 forks source link

Create Configuration class and set up defaults in engine.rb #29

Closed bbarberBPL closed 3 years ago

bbarberBPL commented 4 years ago

We should set up a configuration class that stores objects as accessors. We should store each external service in this(Ie Solr, Minting, Authorization, Derivatives). There are several ways to achieve this. Here are a couple good ones.

http://ndlib.github.io/practices/exposing-configuration-options-in-rails-engines/

https://stackoverflow.com/questions/20734766/rails-mountable-engine-how-should-apps-set-configuration-variables

The main thing we should be aware of is that the configuartion should be initialized/setup in engine.rb and not in the curator.rb class.

ebenenglish commented 4 years ago

This is how we did this in the NewspaperWorks project: https://github.com/samvera-labs/newspaper_works/commit/8577507c640355855e0a5e00261fc055ef3d76fa#diff-42090fab6167c15ed0177498b023437a

The install generator copies an initializer file into the local app.

The config isn't initialized in engine.rb but in lib/newspaper_works.rb; we were copying the pattern from Hyrax.

I imaging the def self.config(&block) could probably be moved to engine.rb?