bendyworks / idkfa

Simple credentials loading
https://github.com/bendyworks/idkfa
4 stars 3 forks source link

Simplify the load_keys method call with default parameters #5

Open bendycode opened 11 years ago

bendycode commented 11 years ago

When faced with the opinionated, default scenario, allow the call to:

Idkfa.load_keys(Rails.env, :credentials => Rails.root.join('config', 'credentials.yml'))

to default to the much simpler:

Idkfa.load_keys()

Still allow the parameters to be specified when the default behavior is not desired.

The env parameter should default to Rails.env if you are in Rails. Use the current production default as the fallback when not specified, and not in Rails.

If :credentials are not passed in via the opts hash, then look for the yaml file in the default path location before raising "You must pass :credentials => 'file.yml' or have a #{DEFAULT_CREDENTIALS_PATH} file".

Change the README to reflect the simpler call.

listrophy commented 11 years ago

Cut scope, be opinionated:

bendycode commented 11 years ago

Love the "Cut scope, be opinionated" refinements.