diff --git a/app/models/dsn.rb b/app/models/dsn.rb index b32f301..0428b34 100644 --- a/app/models/dsn.rb +++ b/app/models/dsn.rb @@ -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 diff --git a/app/views/dsns/show.html.erb b/app/views/dsns/show.html.erb index 40f3c64..7fd53b7 100644 --- a/app/views/dsns/show.html.erb +++ b/app/views/dsns/show.html.erb @@ -34,7 +34,38 @@
<%= @dsn.name %>
-
DSN Key
+
Complete DSN URL
+
+
+

Use this complete URL in your agent configuration:

+
+ <%= @dsn.full_dsn_url %> + +
+
+
+
+
+
API Endpoint
+
+
+ <%= @dsn.api_endpoint_url %> + +
+
+
+
+
DSN Key (for manual auth)
<%= @dsn.key %> diff --git a/config/database.yml b/config/database.yml index dc6e882..ee6a77f 100644 --- a/config/database.yml +++ b/config/database.yml @@ -12,16 +12,13 @@ postgres_default: &postgres_default adapter: postgresql encoding: unicode pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - host: postgres + host: localhost port: 5432 development: primary: <<: *postgres_default - host: localhost - user: dev_user - password: password - database: baffle-dev + database: baffle_hub_development cache: <<: *sqlite_default database: storage/development_cache.sqlite3