Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Silence deprecation warnings in production mode

Oliver Günther3ab94fde7982
diff --git a/config/boot.rb b/config/boot.rb
index 9a26c61a4e6..613030149a5 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -37,8 +37,12 @@ end
require 'bundler/setup' # Set up gems listed in the Gemfile.
-if ENV['RAILS_ENV'] == 'development'
+case ENV['RAILS_ENV']
+when 'production'
+ # Disable deprecation warnings early on (before loading gems), which behaves as RUBYOPT="-w0"
+ # to disable the Ruby 2.7 warnings in production
+ Warning[:deprecated] = ENV['OPENPROJECT_PROD_DEPRECATIONS'] == 'true'
+when 'development'
$stderr.puts "Starting with bootsnap."
-
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
end