Class: Scrivito::Configuration
- Inherits:
-
Object
- Object
- Scrivito::Configuration
- Defined in:
- lib/scrivito/configuration.rb
Constant Summary collapse
- DEFAULT_CA_FILE =
Default path of a CA certification file in PEM format.
File.('../../../config/ca-bundle.crt', __FILE__)
Class Attribute Summary collapse
-
.api_key ⇒ Object
writeonly
Sets the API key.
-
.ca_file ⇒ String
Gets the path of a CA certification file in PEM format.
-
.default_image_transformation ⇒ Object
writeonly
Set the default image transformation.
-
.endpoint ⇒ Object
writeonly
Sets the API endpoint URL.
-
.inject_preset_routes ⇒ Object
The
inject_preset_routes
configuration is enabled by default and adds the default Scrivito routing to your application routes. -
.legacy_routing ⇒ Object
deprecated
Deprecated.
The legacy routing is deprecated and will be removed in the next major version of Scrivito.
-
.ui_locale ⇒ Object
Configures the in-place UI to use a locale different from the one used by the rest of the application.
Class Method Summary collapse
-
.cache_path=(path) ⇒ Object
Set the path for the filesystem cache.
-
.choose_homepage { ... } ⇒ Object
A callback that can be provided for determining the CMS object to be used when visiting the homepage.
-
.editing_auth(&block) {|env| ... } ⇒ Object
Configures a callback to be invoked when the SDK determines whether current visitor is permitted to edit content.
-
.find_user(&find_user_proc) {|user_id| ... } ⇒ Object
Configures how to find users for the in-place GUI.
-
.second_level_cache=(cache_store) ⇒ Object
Sets the second level cache.
-
.tenant=(tenant_name) ⇒ Object
Sets the tenant name.
Class Attribute Details
.api_key=(value) ⇒ Object
Sets the API key. This configuration key must be provided.
147 148 149 |
# File 'lib/scrivito/configuration.rb', line 147 def api_key=(value) @api_key = value end |
.ca_file ⇒ String
Gets the path of a CA certification file in PEM format.
165 166 167 |
# File 'lib/scrivito/configuration.rb', line 165 def ca_file @ca_file end |
.default_image_transformation=(value) ⇒ Object
Set the default image transformation.
When delivering binary Objs, the default image transformation will be applied if Obj#apply_image_transformation? returns true
.
If not changed the default image transformation is an empty transformation (an empty Hash
). Set it to false
to disabled the default image transformation completely.
296 297 298 |
# File 'lib/scrivito/configuration.rb', line 296 def default_image_transformation=(value) @default_image_transformation = value end |
.endpoint=(value) ⇒ Object
Sets the API endpoint URL. This configuration key is optional. Default is ‘api.scrivito.com’. If no schema is provided HTTPS is assumed.
157 158 159 |
# File 'lib/scrivito/configuration.rb', line 157 def endpoint=(value) @endpoint = value end |
.inject_preset_routes ⇒ Object
The inject_preset_routes
configuration is enabled by default and adds the default Scrivito routing to your application routes. It can be disabled by setting it to false
which lets you use scrivito_route to customize the routing used by Scrivito.
261 262 263 |
# File 'lib/scrivito/configuration.rb', line 261 def inject_preset_routes @inject_preset_routes end |
.legacy_routing ⇒ Object
The legacy routing is deprecated and will be removed in the next major version of Scrivito.
Scrivito changed its routing to a slug first url scheme. This configuration option allows you to switch back to the old id first url scheme.
240 241 242 |
# File 'lib/scrivito/configuration.rb', line 240 def legacy_routing @legacy_routing end |
.ui_locale ⇒ Object
Configures the in-place UI to use a locale different from the one used by the rest of the application.
231 232 233 |
# File 'lib/scrivito/configuration.rb', line 231 def ui_locale @ui_locale end |
Class Method Details
.cache_path=(path) ⇒ Object
Set the path for the filesystem cache.
Scrivito
makes heavy use of filesystem caching. Use this method to configure the directory that should be used to store cached data. By default, RAILS_ROOT/tmp/scrivito_cache
will be used.
101 102 103 |
# File 'lib/scrivito/configuration.rb', line 101 def cache_path=(path) CmsDataCache.cache_path = path end |
.choose_homepage { ... } ⇒ Object
A callback that can be provided for determining the CMS object to be used when visiting the homepage. See scrivito_route for details on how to define routes. The callback is called once per request and receives the rack environment as its only parameter. By default, the CMS object at the root path (/
) is used as the homepage.
316 317 318 |
# File 'lib/scrivito/configuration.rb', line 316 def choose_homepage(&block) self.choose_homepage_callback = block end |
.editing_auth(&block) {|env| ... } ⇒ Object
Configures a callback to be invoked when the SDK determines whether current visitor is permitted to edit content.
If the callback is missing in the development
or test
environment, then the SDK will assume, that the current visitor is User.system_user, who can always create workspaces, can always read, write, publish, delete and invite to any workspace.
If the callback is missing in any other environment (for example in production
or staging
), then the SDK will assume, that the current visitor is not permitted to edit content.
44 45 46 47 48 49 50 |
# File 'lib/scrivito/configuration.rb', line 44 def editing_auth(&block) if block.respond_to?(:arity) && block.arity == 1 @editing_auth_callback = block else raise ArgumentError, 'editing_auth should have only one attribute!' end end |
.find_user(&find_user_proc) {|user_id| ... } ⇒ Object
This configuration key is optional. If it is not configured the in-place GUI would behave normally, but would not be able to find any users.
Configures how to find users for the in-place GUI.
80 81 82 |
# File 'lib/scrivito/configuration.rb', line 80 def find_user(&find_user_proc) self.find_user_proc = find_user_proc end |
.second_level_cache=(cache_store) ⇒ Object
Sets the second level cache.
If it is set, then Scrivito
will additionaly store its cache in both: the filesystem cache and the second level cache. Also Scrivito
will search in the second level cache if searching in the filesystem cache returns no results. If the second level cache returns results, then the results will be store in the filesystem cache.
By default it is not set.
@example Use Memcached as the second level cache (https://rubygems.org/gems/dalli)
Scrivito.configure do |config|
config.second_level_cache = ActiveSupport::Cache::DalliStore.new("localhost", "server-downstairs.localnetwork:8229")
end
126 127 128 |
# File 'lib/scrivito/configuration.rb', line 126 def second_level_cache=(cache_store) CmsDataCache.second_level_cache = cache_store end |
.tenant=(tenant_name) ⇒ Object
Sets the tenant name. This configuration key must be provided.
136 137 138 139 |
# File 'lib/scrivito/configuration.rb', line 136 def tenant=(tenant_name) @endpoint_uri = nil @tenant = tenant_name end |