Class: Locomotive::Steam::Middlewares::Site

Inherits:
ThreadSafe
  • Object
show all
Includes:
Concerns::Helpers
Defined in:
lib/locomotive/steam/middlewares/site.rb

Overview

Fetch a site using the site_finder service. Look for an existing site in the rack env variable (context: when launched from the Engine).

Constant Summary

Constants included from Concerns::Helpers

Concerns::Helpers::CACHE_HEADERS, Concerns::Helpers::HTML_CONTENT_TYPE, Concerns::Helpers::HTML_MIME_TYPES

Instance Attribute Summary

Attributes inherited from ThreadSafe

#env

Instance Method Summary collapse

Methods included from Concerns::Helpers

#html?, #inject_cookies, #json?, #log, #make_local_path, #modify_path, #mounted_on, #redirect_to, #render_response

Methods inherited from ThreadSafe

#call, #decorate_entry, #default_liquid_context, #default_locale, #liquid_assigns, #live_editing?, #locale, #locales, #merge_with_params, #next, #page, #params, #path, #repositories, #request, #services, #session, #site

Instance Method Details

#_callObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/locomotive/steam/middlewares/site.rb', line 11

def _call
  site = find_site

  no_site! if site.nil?

  # log anyway
  log_site(site)

  # redirect to the first domain and/or HTTPS if defined by the site
  redirect_if_required(site)
end