Skip to content

Commit

Permalink
Merge pull request #15248 from opf/bug/54061-railsapplicationroutes-d…
Browse files Browse the repository at this point in the history
…ont-respects-openproject_rails__relative__url__root

[#54061] Rails.application.routes don't respects  OPENPROJECT_RAILS__RELATIVE__URL__ROOT
  • Loading branch information
ba1ash committed Apr 16, 2024
2 parents e5f4cfe + fe7d214 commit 65c5fec
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions config/application.rb
Expand Up @@ -124,6 +124,14 @@ class Application < Rails::Application
# That directory contains configurations and patches to rails core functionality.
config.autoload_once_paths << Rails.root.join('lib_static').to_s

# Configure the relative url root to be whatever the configuration is set to.
# This allows for setting the root either via config file or via environment variable.
# It must be called early enough. In our case in should be called earlier
# than `config.exceptions_app = routes`. Otherwise Rails.application.routes.url_helpers
# will not have configured prefix.
# Read https://github.com/rails/rails/issues/42243 for some details.
config.relative_url_root = OpenProject::Configuration['rails_relative_url_root']

# Use our own error rendering for prettier error pages
config.exceptions_app = routes

Expand All @@ -138,7 +146,6 @@ class Application < Rails::Application
# Add locales from crowdin translations to i18n
config.i18n.load_path += Dir[Rails.root.join("config/locales/crowdin/*.{rb,yml}").to_s]
config.i18n.default_locale = :en

# Fall back to default locale
config.i18n.fallbacks = true

Expand Down Expand Up @@ -208,9 +215,6 @@ class Application < Rails::Application
# initialize variable for register plugin tests
config.plugins_to_test_paths = []

# Configure the relative url root to be whatever the configuration is set to.
# This allows for setting the root either via config file or via environment variable.
config.action_controller.relative_url_root = OpenProject::Configuration['rails_relative_url_root']

config.active_job.queue_adapter = :good_job

Expand Down

0 comments on commit 65c5fec

Please sign in to comment.