Class: Locomotive::Steam::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/locomotive/steam/configuration.rb

Instance Attribute Summary collapse

Instance Attribute Details

#adapterObject

Steam needs an adapter in order to fetch the site content (site itself, pages, content entries, …etc). By default, Steam is shipped with 2 adapters:

- Filesystem (options: path). the path option should point to the root path of the site
- MongoDB (options: database, hosts)

default: { name: :filesytem, path: nil }



21
22
23
# File 'lib/locomotive/steam/configuration.rb', line 21

def adapter
  @adapter
end

#asset_hostObject

Enable serving of images, stylesheets, and JavaScripts from an asset server. Useful if a CDN is used to serve assets.

default: nil



52
53
54
# File 'lib/locomotive/steam/configuration.rb', line 52

def asset_host
  @asset_host
end

#asset_pathObject

Path to the assets (if Steam serves the assets).

default: nil



65
66
67
# File 'lib/locomotive/steam/configuration.rb', line 65

def asset_path
  @asset_path
end

#csrf_protectionObject

Enable the Cross-site request forgery protection for POST requests.

default: true



86
87
88
# File 'lib/locomotive/steam/configuration.rb', line 86

def csrf_protection
  @csrf_protection
end

#image_resizer_secretObject

Dragonfly needs it to generate the protective SHA.

default: ‘please change it’



79
80
81
# File 'lib/locomotive/steam/configuration.rb', line 79

def image_resizer_secret
  @image_resizer_secret
end

#middlewareObject

Manage the list of middlewares used by the rack stack.

Example:

Locomotive::Steam.configure do |config|
  ...
  config.middleware.remove Rack::Lint
  ...
  config.middleware.insert_after Middleware::Locale, MySlugMiddleware, answer: 42
  ...
end


35
36
37
# File 'lib/locomotive/steam/configuration.rb', line 35

def middleware
  @middleware
end

#minify_assetsObject

If java is installed and if this option is enabled, then Uglifier and Sass are used to minify the javascript and the css.

default: false



72
73
74
# File 'lib/locomotive/steam/configuration.rb', line 72

def minify_assets
  @minify_assets
end

#modeObject

Mainly used in the liquid templates (variable name: mode }) to distinguish the page rendered in Wagon (:test) or in the Engine.

default: :production



11
12
13
# File 'lib/locomotive/steam/configuration.rb', line 11

def mode
  @mode
end

#monetaObject

Options for the store of Moneta (Session)

default: { store: Moneta.new(:Memory, expires: true) }



93
94
95
# File 'lib/locomotive/steam/configuration.rb', line 93

def moneta
  @moneta
end

#render_404_if_no_siteObject

Render a 404 page if no site has been found. If Steam is embedded in another app, it’s better to let the app handle the no site case.

default: true



102
103
104
# File 'lib/locomotive/steam/configuration.rb', line 102

def render_404_if_no_site
  @render_404_if_no_site
end

#serve_assetsObject

Tell if Steam has to also serve static (images) or dynamic (SASS, Coffeescript) assets.

default: true



58
59
60
# File 'lib/locomotive/steam/configuration.rb', line 58

def serve_assets
  @serve_assets
end

#services_hookObject

Lambda called once a Services instance has been built. It is used when we want to change one of the services

Example:

Locomotive::Steam.configure do |config|

config.services_hook = -> (services) {
  require 'my_custom_site_finder'
  services.site_finder = MyCustomSiteFinder.new
}

end

default: nil



121
122
123
# File 'lib/locomotive/steam/configuration.rb', line 121

def services_hook
  @services_hook
end

#theme_assets_checksumObject

Add the checksum of a theme asset at the end of its path to allow public caching.

default: false (disabled)



44
45
46
# File 'lib/locomotive/steam/configuration.rb', line 44

def theme_assets_checksum
  @theme_assets_checksum
end