Skip to content

Commit

Permalink
Merge pull request #111 from MindscapeHQ/configurable-api-url
Browse files Browse the repository at this point in the history
Configurable api url
  • Loading branch information
UberMouse authored Mar 12, 2017
2 parents b53e65c + a2a1ffa commit 9610308
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 1 addition & 2 deletions lib/raygun/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ class Client

include HTTParty

base_uri "https://api.raygun.io/"

def initialize
@api_key = require_api_key
@headers = {
"X-ApiKey" => @api_key
}

enable_http_proxy if Raygun.configuration.proxy_settings[:address]
self.class.base_uri Raygun.configuration.api_url
end

def require_api_key
Expand Down
6 changes: 5 additions & 1 deletion lib/raygun/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/raygun/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Raygun
VERSION = "1.3.0"
VERSION = "1.4.0"
end
4 changes: 4 additions & 0 deletions test/unit/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9610308

Please sign in to comment.