diff --git a/README.md b/README.md index 7b7e808..2f35c04 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ ChartMogul.account_token = '' ChartMogul.secret_key = '' ``` +Configuration is threadsafe and applied only to the current thread. + Test your authentication: ```ruby ChartMogul::Ping.ping diff --git a/lib/chartmogul.rb b/lib/chartmogul.rb index 9a235c5..f7b160d 100644 --- a/lib/chartmogul.rb +++ b/lib/chartmogul.rb @@ -77,8 +77,11 @@ module ChartMogul class << self extend ConfigAttributes + CONFIG_THREAD_KEY = 'chartmogul_ruby.config' + def config - @config ||= ChartMogul::Configuration.new + Thread.current[CONFIG_THREAD_KEY] = ChartMogul::Configuration.new if Thread.current[CONFIG_THREAD_KEY].nil? + Thread.current[CONFIG_THREAD_KEY] end config_accessor :account_token diff --git a/lib/chartmogul/version.rb b/lib/chartmogul/version.rb index d067e10..f3f52fc 100644 --- a/lib/chartmogul/version.rb +++ b/lib/chartmogul/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ChartMogul - VERSION = '1.5.2' + VERSION = '1.6.0' end