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.
-
.endpoint ⇒ Object
writeonly
Sets the API endpoint URL.
-
.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(&block) ⇒ Object
Configure a callback to be invoked when the Scrivito SDK delivers 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 |
.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 |
.ui_locale ⇒ Object
Configures the in-place UI to use a locale different from the one used by the rest of the application.
226 227 228 |
# File 'lib/scrivito/configuration.rb', line 226 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(&block) ⇒ Object
Configure a callback to be invoked when the Scrivito SDK delivers the homepage. The given callback will receive the rack env and must return an Obj to be used as the homepage. If no callback is configured, Obj.homepage will be used as the default.
235 236 237 |
# File 'lib/scrivito/configuration.rb', line 235 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 |