Class: RailsConnector::Configuration
- Inherits:
-
Object
- Object
- RailsConnector::Configuration
- Defined in:
- lib/rails_connector/configuration.rb
Constant Summary collapse
- DEFAULT_MODE =
:live- DEFAULT_CA_FILE =
Default path of a CA certification file in PEM format.
File.('../../../config/ca-bundle.crt', __FILE__)
Class Attribute Summary collapse
-
.blob_cache_dir ⇒ Object
define a non-default blob cache dir.
-
.ca_file ⇒ Object
Gets path of a CA certification file in PEM format.
-
.content_service ⇒ Object
readonly
Configuration for Content Read Service API.
-
.mode ⇒ Object
there are three available modes for the rails connector:
live(show released contents only),preview(show edited contents)editor(show edited contents and editor interface (e.g. edit markers)) Default mode islive.
Class Method Summary collapse
-
.choose_homepage(&block) ⇒ Object
Configure a callback to be invoked when the rails connector delivers the homepage.
-
.editing_auth(&block) ⇒ Object
Configure a callback to be invoked when the rails connector determines, if current visitor is permitted to edit content.
-
.instance_name=(name) ⇒ Object
Configures your CMS instance name.
Class Attribute Details
.blob_cache_dir ⇒ Object
define a non-default blob cache dir. fiona connector only. has no effect when used with the cloud connector.
37 38 39 |
# File 'lib/rails_connector/configuration.rb', line 37 def blob_cache_dir @blob_cache_dir end |
.ca_file ⇒ Object
Gets path of a CA certification file in PEM format.
66 67 68 |
# File 'lib/rails_connector/configuration.rb', line 66 def ca_file @ca_file end |
.content_service ⇒ Object (readonly)
Configuration for Content Read Service API.
41 42 43 |
# File 'lib/rails_connector/configuration.rb', line 41 def content_service @content_service end |
.mode ⇒ Object
there are three available modes for the rails connector: live (show released contents only), preview (show edited contents) editor (show edited contents and editor interface (e.g. edit markers)) Default mode is live.
29 30 31 |
# File 'lib/rails_connector/configuration.rb', line 29 def mode @mode end |
Class Method Details
.choose_homepage(&block) ⇒ Object
Configure a callback to be invoked when the rails connector 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.
164 165 166 |
# File 'lib/rails_connector/configuration.rb', line 164 def choose_homepage(&block) self.choose_homepage_callback = block end |
.editing_auth(&block) ⇒ Object
Configure a callback to be invoked when the rails connector determines, if current visitor is permitted to edit content. Default is false.
Example Usage:
RailsConnector::Configuation.editing_auth do |env|
request = Rack::Request.new(env)
# return truey if current visitor is permitted to edit content, falsy otherwise
end
56 57 58 59 60 61 62 |
# File 'lib/rails_connector/configuration.rb', line 56 def editing_auth(&block) if block.respond_to?(:arity) && block.arity == 1 self.editing_auth_callback = block else raise ArgumentError, 'editing_auth should have only one attribute!' end end |
.instance_name=(name) ⇒ Object
Configures your CMS instance name.
Example call as to be used in rails_connector.rb:
RailsConnector::Configuration.instance_name = 'internet'
127 128 129 |
# File 'lib/rails_connector/configuration.rb', line 127 def instance_name=(name) RailsConnector::CmsBaseModel.instance_name = name if RailsConnector.platform_fiona? end |