Class: Locomotive::Steam::Configuration
- Inherits:
-
Object
- Object
- Locomotive::Steam::Configuration
- Defined in:
- lib/locomotive/steam/configuration.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Steam needs an adapter in order to fetch the site content (site itself, pages, content entries, …etc).
-
#asset_host ⇒ Object
Enable serving of images, stylesheets, and JavaScripts from an asset server.
-
#asset_path ⇒ Object
Path to the assets (if Steam serves the assets).
-
#csrf_protection ⇒ Object
Enable the Cross-site request forgery protection for POST requests.
-
#image_resizer_secret ⇒ Object
Dragonfly needs it to generate the protective SHA.
-
#middleware ⇒ Object
Manage the list of middlewares used by the rack stack.
-
#minify_assets ⇒ Object
If java is installed and if this option is enabled, then Uglifier and Sass are used to minify the javascript and the css.
-
#mode ⇒ Object
Mainly used in the liquid templates (variable name: mode }) to distinguish the page rendered in Wagon (:test) or in the Engine.
-
#moneta ⇒ Object
Options for the store of Moneta (Session).
-
#render_404_if_no_site ⇒ Object
Render a 404 page if no site has been found.
-
#serve_assets ⇒ Object
Tell if Steam has to also serve static (images) or dynamic (SASS, Coffeescript) assets.
-
#services_hook ⇒ Object
Lambda called once a Services instance has been built.
-
#theme_assets_checksum ⇒ Object
Add the checksum of a theme asset at the end of its path to allow public caching.
Instance Attribute Details
#adapter ⇒ Object
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_host ⇒ Object
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_path ⇒ Object
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_protection ⇒ Object
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_secret ⇒ Object
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 |
#middleware ⇒ Object
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_assets ⇒ Object
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 |
#mode ⇒ Object
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 |
#moneta ⇒ Object
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_site ⇒ Object
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_assets ⇒ Object
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_hook ⇒ Object
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_checksum ⇒ Object
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 |