Reconfiguring the subdomain does not work
wsmoak opened this issue · 0 comments
wsmoak commented
If you configure the gem initially and then repeat the configuration block, such as:
Chargify.configure do |c|
c.subdomain = ENV['CHARGIFY_OTHER_SUBDOMAIN']
c.api_key = ENV['CHARGIFY_API_KEY']
end
It does not work. Requests still go to the original subdomain.
Internally, the 'site' is cached from the original config, and must be cleared out before you can reconfigure. (Thanks to @moklett for the info.)
Chargify.configure do |c|
c.site = nil
c.subdomain = ENV['CHARGIFY_OTHER_SUBDOMAIN']
c.api_key = ENV['CHARGIFY_API_KEY']
end
Here is an example of switching sites, with the workaround:
https://github.com/wsmoak/chargify/blob/master/ruby/multiple-sites.rb
Can this be fixed so that reconfiguring is easier?