Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable api url #111

Merged
merged 3 commits into from
Mar 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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