From ce2feb4180eb06afd1b1f33ce600a5589f72696c Mon Sep 17 00:00:00 2001 From: Dan Milne Date: Sun, 9 Nov 2025 22:09:56 +1100 Subject: [PATCH] fix baffle_host --- app/models/dsn.rb | 6 ++++-- app/views/dsns/show.html.erb | 8 +++++--- test/fixtures/ipv4_ranges.yml | 2 -- test/fixtures/ipv6_ranges.yml | 2 -- test/fixtures/rule_sets.yml | 1 - 5 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 test/fixtures/ipv4_ranges.yml delete mode 100644 test/fixtures/ipv6_ranges.yml delete mode 100644 test/fixtures/rule_sets.yml diff --git a/app/models/dsn.rb b/app/models/dsn.rb index 0428b34..ba5c79f 100644 --- a/app/models/dsn.rb +++ b/app/models/dsn.rb @@ -13,7 +13,8 @@ class Dsn < ApplicationRecord 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] || + domain = ENV['BAFFLE_HOST'] || + Rails.application.config.action_mailer.default_url_options[:host] || ENV['RAILS_HOST'] || 'localhost:3000' @@ -23,7 +24,8 @@ class Dsn < ApplicationRecord def api_endpoint_url # Just the API endpoint URL (without key) - domain = Rails.application.config.action_mailer.default_url_options[:host] || + domain = ENV['BAFFLE_HOST'] || + Rails.application.config.action_mailer.default_url_options[:host] || ENV['RAILS_HOST'] || 'localhost:3000' diff --git a/app/views/dsns/show.html.erb b/app/views/dsns/show.html.erb index 7fd53b7..cea0b09 100644 --- a/app/views/dsns/show.html.erb +++ b/app/views/dsns/show.html.erb @@ -111,11 +111,13 @@

Actions

<% if @dsn.enabled? && policy(@dsn).disable? %> - <%= link_to "Disable DSN", disable_dsn_path(@dsn), method: :post, - data: { confirm: "Are you sure you want to disable this DSN? Agents will no longer be able to authenticate with this key." }, + <%= button_to "Disable DSN", disable_dsn_path(@dsn), + method: :post, + data: { turbo_confirm: "Are you sure you want to disable this DSN? Agents will no longer be able to authenticate with this key." }, class: "inline-flex items-center px-4 py-2 border border-red-300 rounded-md shadow-sm text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" %> <% elsif !@dsn.enabled? && policy(@dsn).enable? %> - <%= link_to "Enable DSN", enable_dsn_path(@dsn), method: :post, + <%= button_to "Enable DSN", enable_dsn_path(@dsn), + method: :post, class: "inline-flex items-center px-4 py-2 border border-green-300 rounded-md shadow-sm text-sm font-medium text-green-700 bg-white hover:bg-green-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500" %> <% end %>
diff --git a/test/fixtures/ipv4_ranges.yml b/test/fixtures/ipv4_ranges.yml deleted file mode 100644 index 3a3f815..0000000 --- a/test/fixtures/ipv4_ranges.yml +++ /dev/null @@ -1,2 +0,0 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -# Empty fixtures - tests create their own data diff --git a/test/fixtures/ipv6_ranges.yml b/test/fixtures/ipv6_ranges.yml deleted file mode 100644 index 3a3f815..0000000 --- a/test/fixtures/ipv6_ranges.yml +++ /dev/null @@ -1,2 +0,0 @@ -# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -# Empty fixtures - tests create their own data diff --git a/test/fixtures/rule_sets.yml b/test/fixtures/rule_sets.yml deleted file mode 100644 index 0e9e559..0000000 --- a/test/fixtures/rule_sets.yml +++ /dev/null @@ -1 +0,0 @@ -# Empty fixtures