findbug 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6be157fb43d73577d48e404ce60565bb9673318fb35c00591a4cd070890793d
4
- data.tar.gz: 2ab1e58a35a8a02997f1f56427d8a62bdce9d99b45270bdcfe1c7529e492081e
3
+ metadata.gz: febb3a02b6cd7b7791b2b64fbcfa2222a5adedcd591cc3096dc9e3f4128e430d
4
+ data.tar.gz: c6714e86d56418b5afe1bdcaf84f0a4e1f8e8676872c07a54ff49092539751b8
5
5
  SHA512:
6
- metadata.gz: b8ed796ca72ce63cce24145fb2654f234b7e8d0c3391405d5ab110473f456f5df849f121503d6e33c25e3e538da3f06194baf82a3d9994a132afa7c01c6ac790
7
- data.tar.gz: 28e59dc8442a8a88498e709e575bc2a561d02b44455d729136f8bc50e06340a77a274c4de119611d00788f6b5dc11140fc3b0a91a2c1abf4b83fac00a1916c58
6
+ metadata.gz: c239228a5a8a06668260ebea57ff173a53d255b23a7607816129399d1bca45fa98c4a915079f58ac44d766c55b160799505a03e63e917e993b7660b8edd21321
7
+ data.tar.gz: d181ff1a682f7e04ab4cf85261d81bf95b59ee53aa4cebd45328cc750ec896408378d0e26fcc15f4388301ba03670d5d328e3dc3665cbc3371f10ac3b4bd08c3
@@ -1,18 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rails/engine"
4
- require "active_record"
5
4
 
6
5
  # Calculate the gem root path once at load time
7
6
  # __dir__ is lib/findbug, so we go up two levels to get the gem root
8
7
  FINDBUG_GEM_ROOT = File.expand_path("../..", __dir__)
9
8
 
10
- # Require models early so they're available for multi-tenant gems (Apartment)
11
- # that resolve excluded_models during boot via Object.const_get.
12
- # This must happen before Apartment's initializer runs.
13
- require_relative "../../app/models/findbug/error_event"
14
- require_relative "../../app/models/findbug/performance_event"
15
-
16
9
  # Require controllers (needed for routing)
17
10
  require_relative "../../app/controllers/findbug/application_controller"
18
11
  require_relative "../../app/controllers/findbug/dashboard_controller"
@@ -2,10 +2,6 @@
2
2
 
3
3
  require "rails/railtie"
4
4
 
5
- # Load the engine early so models are available for multi-tenant gems (Apartment)
6
- # that resolve excluded_models during boot via Object.const_get.
7
- require_relative "engine"
8
-
9
5
  module Findbug
10
6
  # Railtie hooks Findbug into the Rails boot process.
11
7
  #
@@ -54,6 +50,18 @@ module Findbug
54
50
  # - All models to be loaded
55
51
  #
56
52
  class Railtie < Rails::Railtie
53
+ # Load models early for multi-tenant gems (Apartment/ros-apartment)
54
+ #
55
+ # Apartment resolves excluded_models via Object.const_get during its
56
+ # initializer. We need our models loaded before that happens.
57
+ # Using :load_active_record hook ensures ActiveRecord::Base is available.
58
+ #
59
+ initializer "findbug.load_models", after: :load_active_record do
60
+ models_path = File.expand_path("../../app/models/findbug", __dir__)
61
+ require "#{models_path}/error_event"
62
+ require "#{models_path}/performance_event"
63
+ end
64
+
57
65
  # Register our middleware to catch exceptions
58
66
  #
59
67
  # MIDDLEWARE ORDER MATTERS!
@@ -121,7 +129,7 @@ module Findbug
121
129
  app.config.after_initialize do
122
130
  next unless Findbug.config.web_enabled?
123
131
 
124
- # Engine is already loaded at top of railtie.rb for Apartment compatibility
132
+ require_relative "engine"
125
133
 
126
134
  # Add routes programmatically
127
135
  # This is equivalent to `mount Findbug::Engine => "/findbug"` in routes.rb
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Findbug
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.4"
5
5
  end
@@ -17,17 +17,19 @@ Next steps:
17
17
  # Or set directly in config/initializers/findbug.rb:
18
18
  config.redis_url = "redis://localhost:6379/1"
19
19
 
20
- 3. Configure dashboard authentication (required):
20
+ 3. Access the dashboard:
21
21
 
22
- # Add to your environment variables or .env file:
23
- FINDBUG_USERNAME=admin
24
- FINDBUG_PASSWORD=your-secure-password
22
+ http://localhost:3000/findbug
25
23
 
26
- 5. Access the dashboard:
24
+ Default credentials (CHANGE IN PRODUCTION!):
25
+ Username: admin
26
+ Password: findbug
27
27
 
28
- http://localhost:3000/findbug
28
+ To customize, set environment variables:
29
+ FINDBUG_USERNAME=your-username
30
+ FINDBUG_PASSWORD=your-secure-password
29
31
 
30
- 6. (Optional) Configure alerts in config/initializers/findbug.rb:
32
+ 4. (Optional) Configure alerts in config/initializers/findbug.rb:
31
33
 
32
34
  config.alerts do |alerts|
33
35
  alerts.slack(
@@ -36,7 +38,7 @@ Next steps:
36
38
  )
37
39
  end
38
40
 
39
- 7. (Multi-tenant apps) If using Apartment/ros-apartment, add to apartment.rb:
41
+ 5. (Multi-tenant apps) If using Apartment/ros-apartment, add to apartment.rb:
40
42
 
41
43
  config.excluded_models = %w[Findbug::ErrorEvent Findbug::PerformanceEvent]
42
44
 
@@ -102,9 +102,9 @@ Findbug.configure do |config|
102
102
  # ============================================================================
103
103
 
104
104
  # Dashboard authentication (required for dashboard to be enabled)
105
- # We recommend using environment variables for security
106
- config.web_username = ENV["FINDBUG_USERNAME"]
107
- config.web_password = ENV["FINDBUG_PASSWORD"]
105
+ # Default credentials are set for development - CHANGE THESE IN PRODUCTION!
106
+ config.web_username = ENV.fetch("FINDBUG_USERNAME", "admin")
107
+ config.web_password = ENV.fetch("FINDBUG_PASSWORD", "findbug")
108
108
 
109
109
  # Dashboard URL path (default: "/findbug")
110
110
  config.web_path = "/findbug"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: findbug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soumit Das