Class: Scrivito::Configuration
- Inherits:
-
Object
- Object
- Scrivito::Configuration
- Defined in:
- app/cms/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 Method Summary collapse
-
.api_key=(value) ⇒ Object
Sets the API key.
-
.ca_file ⇒ String
Gets the path of a CA certification file in PEM format.
-
.ca_file=(path) ⇒ Object
Sets path of a CA certification file in PEM format.
-
.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.
-
.default_image_transformation=(value) ⇒ Object
Set the default image transformation.
-
.editing_auth(&block) {|env| ... } ⇒ Object
Configures a callback to be invoked when the SDK determines whether the current visitor is permitted to edit content.
-
.endpoint=(value) ⇒ Object
Sets the API endpoint URL.
-
.find_user(&find_user_proc) {|user_id| ... } ⇒ Object
Configures how to find users for the in-place UI.
-
.inject_preset_routes=(value) ⇒ 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.
-
.minimum_open_timeout=(value) ⇒ Object
Sets a minimum Net::HTTP#open_timeout for endpoint connections.
-
.minimum_read_timeout=(value) ⇒ Object
Sets a minimum Net::HTTP#read_timeout for endpoint connections.
-
.minimum_ssl_timeout=(value) ⇒ Object
Sets a minimum Net::HTTP#ssl_timeout for endpoint connections.
-
.second_level_cache=(cache_store) ⇒ Object
Sets the second level cache.
-
.tenant=(tenant_name) ⇒ Object
Sets the tenant name.
-
.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 Details
.api_key=(value) ⇒ Object
Sets the API key. This configuration key must be provided.
153 154 155 |
# File 'app/cms/scrivito/configuration.rb', line 153 def self.api_key=(value) @api_key = value end |
.ca_file ⇒ String
Gets the path of a CA certification file in PEM format.
214 215 216 |
# File 'app/cms/scrivito/configuration.rb', line 214 def self.ca_file @ca_file end |
.ca_file=(path) ⇒ Object
Sets path of a CA certification file in PEM format. The file can contain several CA certificates. Certifications will be used for endpoint peer verification of various scrivito services e.g. Content Read Service.
223 224 225 226 227 228 |
# File 'app/cms/scrivito/configuration.rb', line 223 def self.ca_file=(path) if path # Try to read the given file and fail if it doesn't exist or is not readable. File.read(path) end @ca_file = path end |
.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.
106 107 108 |
# File 'app/cms/scrivito/configuration.rb', line 106 def self.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.
400 401 402 |
# File 'app/cms/scrivito/configuration.rb', line 400 def self.choose_homepage(&block) self.choose_homepage_callback = block end |
.default_image_transformation=(value) ⇒ Object
Set the default image transformation.
When delivering binary Objs, the default image transformation will be applied.
If not changed the default image transformation is an empty transformation (an empty Hash
). Set it to false
to disable the default image transformation completely.
376 377 378 |
# File 'app/cms/scrivito/configuration.rb', line 376 def self.default_image_transformation=(value) @default_image_transformation = value end |
.editing_auth(&block) {|env| ... } ⇒ Object
Configures a callback to be invoked when the SDK determines whether the 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.
49 50 51 52 53 54 55 |
# File 'app/cms/scrivito/configuration.rb', line 49 def self.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 |
.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.
165 166 167 |
# File 'app/cms/scrivito/configuration.rb', line 165 def self.endpoint=(value) @endpoint = value end |
.find_user(&find_user_proc) {|user_id| ... } ⇒ Object
This configuration key is optional. If it is not configured the in-place UI would behave normally, but would not be able to find any users.
Configures how to find users for the in-place UI.
85 86 87 |
# File 'app/cms/scrivito/configuration.rb', line 85 def self.find_user(&find_user_proc) self.find_user_proc = find_user_proc end |
.inject_preset_routes=(value) ⇒ 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.
324 325 326 |
# File 'app/cms/scrivito/configuration.rb', line 324 def self.inject_preset_routes=(value) @inject_preset_routes = value 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.
301 302 303 |
# File 'app/cms/scrivito/configuration.rb', line 301 def self.legacy_routing @legacy_routing end |
.minimum_open_timeout=(value) ⇒ Object
Sets a minimum Net::HTTP#open_timeout for endpoint connections.
Default is 0.5
178 179 180 |
# File 'app/cms/scrivito/configuration.rb', line 178 def self.minimum_open_timeout=(value) ConnectionManager.minimum_open_timeout = value end |
.minimum_read_timeout=(value) ⇒ Object
Sets a minimum Net::HTTP#read_timeout for endpoint connections.
Default is 0.5
204 205 206 |
# File 'app/cms/scrivito/configuration.rb', line 204 def self.minimum_read_timeout=(value) ConnectionManager.minimum_read_timeout = value end |
.minimum_ssl_timeout=(value) ⇒ Object
Sets a minimum Net::HTTP#ssl_timeout for endpoint connections.
Default is 1.0
191 192 193 |
# File 'app/cms/scrivito/configuration.rb', line 191 def self.minimum_ssl_timeout=(value) ConnectionManager.minimum_ssl_timeout = value end |
.second_level_cache=(cache_store) ⇒ Object
Sets the second level cache.
If it is set, then Scrivito
will additionally store its cache in both: the filesystem cache and the second level cache. Also Scrivito
will search in the second level cache if a search in the filesystem cache returns no results. If the second level cache returns results, then the results will be stored 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
132 133 134 |
# File 'app/cms/scrivito/configuration.rb', line 132 def self.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.
142 143 144 145 |
# File 'app/cms/scrivito/configuration.rb', line 142 def self.tenant=(tenant_name) @endpoint_uri = nil @tenant = tenant_name end |
.ui_locale ⇒ Object
Configures the in-place UI to use a locale different from the one used by the rest of the application.
This configuration overrides the browser-based UI language detection. The per-user UI language definition overrides this.
287 288 289 |
# File 'app/cms/scrivito/configuration.rb', line 287 def self.ui_locale @ui_locale end |