Skip to content

Commit

Permalink
Require bridgetown when booting from Rack
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushn21 committed Jan 14, 2025
1 parent 6156c61 commit ce32951
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions bridgetown-core/lib/bridgetown-core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,16 @@ def environment

# Set up the Bridgetown execution environment before attempting to load any
# plugins or gems prior to a site build
def begin!
def begin!(with_config: :preflight)
ENV["RACK_ENV"] ||= environment

Bridgetown::Current.preloaded_configuration = Bridgetown::Configuration::Preflight.new
if with_config == :preflight
Bridgetown::Current.preloaded_configuration ||= Bridgetown::Configuration::Preflight.new
elsif with_config == :initializers &&
!Bridgetown::Current.preloaded_configuration.is_a?(Bridgetown::Configuration)
Bridgetown::Current.preloaded_configuration = Bridgetown.configuration
end

Bridgetown::PluginManager.setup_bundler
end

Expand Down
5 changes: 3 additions & 2 deletions bridgetown-core/lib/bridgetown-core/rack/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
require "zeitwerk"
require "roda"
require "json"

Bridgetown::Current.preloaded_configuration ||= Bridgetown.configuration
require "bridgetown"

require_relative "loader_hooks"
require_relative "logger"
require_relative "routes"

module Bridgetown
module Rack
Bridgetown.begin!(with_config: :initializers)

class << self
# @return [Bridgetown::Utils::LoadersManager]
attr_accessor :loaders_manager
Expand Down

0 comments on commit ce32951

Please sign in to comment.