From 55ffd93c0f9f9da550c43ab5edbae7a42e7b98c9 Mon Sep 17 00:00:00 2001 From: Taylor Lodge Date: Mon, 13 Mar 2017 11:18:37 +1300 Subject: [PATCH 1/3] Add config option for API url --- lib/raygun/configuration.rb | 6 +++++- test/unit/configuration_test.rb | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/raygun/configuration.rb b/lib/raygun/configuration.rb index 73bec6d..2d29396 100644 --- a/lib/raygun/configuration.rb +++ b/lib/raygun/configuration.rb @@ -67,6 +67,9 @@ def self.proc_config_option(name) # Set this to true to have raygun4ruby log the reason why it skips reporting an exception config_option :debug + # Override this if you wish to connect to a different Raygun API than the standard one + config_option :api_url + # Exception classes to ignore by default IGNORE_DEFAULT = ['ActiveRecord::RecordNotFound', 'ActionController::RoutingError', @@ -115,7 +118,8 @@ def initialize filter_payload_with_whitelist: false, whitelist_payload_shape: DEFAULT_WHITELIST_PAYLOAD_SHAPE, proxy_settings: {}, - debug: false + debug: false, + api_url: 'https://api.raygun.io/' }) end diff --git a/test/unit/configuration_test.rb b/test/unit/configuration_test.rb index b010abb..531c643 100644 --- a/test/unit/configuration_test.rb +++ b/test/unit/configuration_test.rb @@ -125,4 +125,8 @@ def test_setting_custom_data_to_hash ensure Raygun.configuration.custom_data = nil end + + def test_api_url_default + assert_equal "https://api.raygun.io/", Raygun.configuration.api_url + end end From 7c01d85d38dc33e3a55a1f3497ec4d4ddaf766ae Mon Sep 17 00:00:00 2001 From: Taylor Lodge Date: Mon, 13 Mar 2017 11:22:25 +1300 Subject: [PATCH 2/3] Use configuration.api_url to set base_uri --- lib/raygun/client.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/raygun/client.rb b/lib/raygun/client.rb index 32469c5..993ddc4 100644 --- a/lib/raygun/client.rb +++ b/lib/raygun/client.rb @@ -8,8 +8,6 @@ class Client include HTTParty - base_uri "https://api.raygun.io/" - def initialize @api_key = require_api_key @headers = { @@ -17,6 +15,7 @@ def initialize } enable_http_proxy if Raygun.configuration.proxy_settings[:address] + self.class.base_uri Raygun.configuration.api_url end def require_api_key From a2a1ffa4b660588b8c6b3a3f38ae14849876fb84 Mon Sep 17 00:00:00 2001 From: Taylor Lodge Date: Mon, 13 Mar 2017 11:23:18 +1300 Subject: [PATCH 3/3] Bump version and update CHANGELOG --- CHANGELOG.md | 5 +++++ lib/raygun/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d954214..b7cf4ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.4.0 + +Features: + - Raygun API url is now configurable via `Configuration.api_url` + ## 1.3.0 (10/03/2017) Features: diff --git a/lib/raygun/version.rb b/lib/raygun/version.rb index 418c02a..a88c775 100644 --- a/lib/raygun/version.rb +++ b/lib/raygun/version.rb @@ -1,3 +1,3 @@ module Raygun - VERSION = "1.3.0" + VERSION = "1.4.0" end