Skip to content

Commit

Permalink
Merge pull request #183 from datacite/investigate-500-errors
Browse files Browse the repository at this point in the history
fix zeitwerk load errors
  • Loading branch information
wendelfabianchinsamy authored May 20, 2024
2 parents e981db7 + 257dbc9 commit d775f34
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ We use Rspec for unit and acceptance testing:
bundle exec rspec
```

To run the Rails console:

```
DISABLE_SPRING=true bundle exec rails console
```

## Technical Description

### Resource components
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def transform_params
elsif status == 409
message = "The resource already exists."
else
Raven.capture_exception(exception)
message = exception.message
end

Expand Down
13 changes: 7 additions & 6 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ module Sashimi
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
config.autoload_paths << Rails.root.join('lib')
config.autoload_once_paths << Rails.root.join('lib')
config.autoload_paths << Rails.root.join("app", "models", "concerns")
config.autoload_paths += %W(#{config.root}/lib #{config.root}/lib/middleware)

# Allow middleware to be loaded. (compressed_requests)
config.autoload_lib(ignore: nil)
config.eager_load_paths << Rails.root.join("lib")
config.eager_load_paths << Rails.root.join("app", "models", "concerns")

# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
Expand All @@ -76,8 +75,8 @@ class Application < Rails::Application
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Logstash.new
config.lograge.logger = LogStashLogger.new(type: :stdout)
config.logger = config.lograge.logger ## LogStashLogger needs to be pass to rails logger, see roidrage/lograge#26
config.log_level = ENV["LOG_LEVEL"].to_sym ## Log level in a config level configuration
config.logger = config.lograge.logger
config.log_level = ENV["LOG_LEVEL"].to_sym

config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"]
config.lograge.ignore_custom = lambda do |event|
Expand All @@ -93,6 +92,8 @@ class Application < Rails::Application
}
end

config.action_dispatch.debug_exception_log_level = :error

# configure caching
config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"], { namespace: ENV["APPLICATION"] }

Expand Down
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
url: "/report_files/:filename",
use_timestamp: false,
}

config.action_dispatch.show_exceptions = false
end

#BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP']
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/middlewares.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "./lib/middleware/compressed_requests"

Rails.application.configure do
Expand Down
2 changes: 2 additions & 0 deletions lib/middleware/compressed_requests.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Middleware
class CompressedRequests
def initialize(app)
Expand Down

0 comments on commit d775f34

Please sign in to comment.