Class: RailsConnector::Configuration

Inherits:
Object
  • Object
show all
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.expand_path('../../../config/ca-bundle.crt', __FILE__)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.blob_cache_dirObject

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_fileObject

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_serviceObject (readonly)

Configuration for Content Read Service API.



41
42
43
# File 'lib/rails_connector/configuration.rb', line 41

def content_service
  @content_service
end

.modeObject

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