killbill / killbill-plugin-framework-ruby

Framework to write Kill Bill plugins in Ruby
http://killbill.io
8 stars 11 forks source link

Merge global configuration into each account specific configuration #61

Closed andrenpaes closed 7 years ago

andrenpaes commented 7 years ago

This PR makes sure we merge the configuration defined in the global plugin config (usually a file deployed with the application), with the config of each of the accounts defined for a plugin.

For the cybersource plugin, .the tenant config hash would look like this:

{:cybersource => [{:account_id => 1}, {:account_id => 2}, ...]}

While the global config looks like:

{:cybersource => {:test => true, :test_url => ...}}

That means we can't just merge the two config hashes (which is pointless, since they both contain a :cybersource key). We have to, instead, extracts the global config in the global_defaults variable, and for each account, merge its configuration with the global_defaults hash. Nothing is overwritten.