diff --git a/lib/intercom-rails/config.rb b/lib/intercom-rails/config.rb index 751d949..2725dc4 100644 --- a/lib/intercom-rails/config.rb +++ b/lib/intercom-rails/config.rb @@ -98,6 +98,10 @@ def self.reset! config_accessor :enabled_environments, &ARRAY_VALIDATOR config_accessor :include_for_logged_out_users + def self.api_key=(*) + warn "Setting an Intercom API key is no longer supported; remove the `config.api_key = ...` line from config/initializers/intercom.rb" + end + config_group :user do config_accessor :current, &IS_PROC_OR_ARRAY_OF_PROC_VALIDATOR config_accessor :exclude_if, &IS_PROC_VALIDATOR diff --git a/spec/config_spec.rb b/spec/config_spec.rb index 83502b5..9e28d77 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -75,4 +75,10 @@ expect(IntercomRails.config.user.custom_data).to eq(nil) expect(IntercomRails.config.inbox.style).to eq(nil) end + + it 'prints a deprecation warning when #api_key= is used' do + expect do + IntercomRails.config.api_key = "foo" + end.to output(/no longer supported/).to_stderr + end end