Module: Bridgetown::Rack

Defined in:
bridgetown-core/lib/bridgetown-core/rack/boot.rb,
bridgetown-core/lib/bridgetown-core/rack/logger.rb,
bridgetown-core/lib/bridgetown-core/rack/routes.rb,
bridgetown-core/lib/bridgetown-core/rack/loader_hooks.rb

Defined Under Namespace

Modules: LoaderHooks Classes: Logger, Routes

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loaders_managerBridgetown::Utils::LoadersManager



17
18
19
# File 'bridgetown-core/lib/bridgetown-core/rack/boot.rb', line 17

def loaders_manager
  @loaders_manager
end

Class Method Details

.bootObject

Start up the Roda Rack application and the Zeitwerk autoloaders. Ensure the Roda app is provided the preloaded Bridgetown site configuration. Handle any uncaught Roda errors.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'bridgetown-core/lib/bridgetown-core/rack/boot.rb', line 23

def self.boot(*)
  self.loaders_manager =
    Bridgetown::Utils::LoadersManager.new(Bridgetown::Current.preloaded_configuration)
  Bridgetown::Current.preloaded_configuration.run_initializers! context: :server
  LoaderHooks.autoload_server_folder(
    File.join(Bridgetown::Current.preloaded_configuration.root_dir, "server")
  )
rescue Roda::RodaError => e
  if e.message.include?("sessions plugin :secret option")
    raise Bridgetown::Errors::InvalidConfigurationError,
          "The Roda sessions plugin can't find a valid secret. Run `bin/bridgetown secret' " \
          "and put the key in a ENV var you can use to configure the session in the Roda app"
  end

  raise e
end