generate proper DSN.
This commit is contained in:
@@ -10,6 +10,27 @@ class Dsn < ApplicationRecord
|
||||
enabled.find_by(key: key)
|
||||
end
|
||||
|
||||
def full_dsn_url
|
||||
# Generate a complete DSN URL like Sentry does
|
||||
# Format: https://{key}@{domain}/api/events
|
||||
domain = Rails.application.config.action_mailer.default_url_options[:host] ||
|
||||
ENV['RAILS_HOST'] ||
|
||||
'localhost:3000'
|
||||
|
||||
protocol = Rails.env.development? ? 'http' : 'https'
|
||||
"#{protocol}://#{key}@#{domain}/api/events"
|
||||
end
|
||||
|
||||
def api_endpoint_url
|
||||
# Just the API endpoint URL (without key)
|
||||
domain = Rails.application.config.action_mailer.default_url_options[:host] ||
|
||||
ENV['RAILS_HOST'] ||
|
||||
'localhost:3000'
|
||||
|
||||
protocol = Rails.env.development? ? 'http' : 'https'
|
||||
"#{protocol}://#{domain}/api/events"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_key
|
||||
|
||||
Reference in New Issue
Block a user