Skip to content

Do not preload settings

What does this MR do?

This fixes problem of hot-reloading sources, visible in: spring, unicorn and rails console:

Reloading...
Settingslogic::MissingSetting: Missing setting 'visibility_level' in 'default_projects_features' section in 'gitlab' section in /home/shinya/workspace/gdk-ce/gitlab/config/gitlab.yml
from /home/shinya/workspace/gdk-ce/gitlab/config/initializers/routing_draw.rb:5:in `instance_eval'

The problem is the ordering of operations:

  1. First lib/settings.rb is loaded,
  2. Then config/initializers/1_settings.rb is loaded,
  3. Once reloaded,
  4. Only lib/settings.rb is loaded.

There are probably two approaches:

  1. Always when reloading also preload 1_settings.rb, but this has a problem that other initializers do depend on specific configuration,
  2. Store config/settings.rb, so outside of eager loadings. It makes it behave as previously, preload will not touch Settings class.

I took the 2., as the one that is more stable.

Does this MR meet the acceptance criteria?

cc @rymai

Edited by Kamil Trzciński (Back 2025-01-01)

Merge request reports

Loading