Class: Landable::Configuration
- Inherits:
-
HashWithIndifferentAccess
- Object
- HashWithIndifferentAccess
- Landable::Configuration
show all
- Defined in:
- lib/landable/configuration.rb
Defined Under Namespace
Classes: CORS, Screenshots
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config_path = nil) ⇒ Configuration
Returns a new instance of Configuration.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/landable/configuration.rb', line 18
def initialize(config_path = nil)
begin
app_config = Figgy.build do |config_data|
config_data.root = config_path
config_data.define_overlay :default, nil
config_data.define_overlay(:environment) { Rails.env }
end
config_keys(config_path).each do |key|
self[key] = app_config[key] unless app_config[key].nil?
end
end unless config_path.nil?
end
|
Instance Attribute Details
#amqp_configuration ⇒ Object
Returns the value of attribute amqp_configuration.
5
6
7
|
# File 'lib/landable/configuration.rb', line 5
def amqp_configuration
@amqp_configuration
end
|
#amqp_event_mapping ⇒ Object
179
180
181
|
# File 'lib/landable/configuration.rb', line 179
def amqp_event_mapping
@amqp_event_mapping ||= {}
end
|
#amqp_messaging_service=(value) ⇒ Object
Sets the attribute amqp_messaging_service
16
17
18
|
# File 'lib/landable/configuration.rb', line 16
def amqp_messaging_service=(value)
@amqp_messaging_service = value
end
|
#amqp_service_enabled ⇒ Object
183
184
185
|
# File 'lib/landable/configuration.rb', line 183
def amqp_service_enabled
amqp_configuration[:enabled] && amqp_configuration[:messaging_service]
end
|
#amqp_site_segment ⇒ Object
175
176
177
|
# File 'lib/landable/configuration.rb', line 175
def amqp_site_segment
@amqp_site_segment ||= Rails.application.class.parent_name
end
|
#api_host ⇒ Object
58
59
60
|
# File 'lib/landable/configuration.rb', line 58
def api_host
@api_host ||= api_uri.try(:host)
end
|
#api_namespace ⇒ Object
62
63
64
|
# File 'lib/landable/configuration.rb', line 62
def api_namespace
@api_namespace ||= (api_uri.try(:path).presence || '/api/landable')
end
|
#api_url ⇒ Object
Returns the value of attribute api_url.
5
6
7
|
# File 'lib/landable/configuration.rb', line 5
def api_url
@api_url
end
|
#audit_flags ⇒ Object
74
75
76
|
# File 'lib/landable/configuration.rb', line 74
def audit_flags
@audit_flags ||= []
end
|
#blank_user_agent_string ⇒ Object
162
163
164
|
# File 'lib/landable/configuration.rb', line 162
def blank_user_agent_string
@blank_user_agent_string ||= 'blank'
end
|
#categories ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/landable/configuration.rb', line 90
def categories
@categories ||= {
'Affiliates' => '',
'PPC' => 'Pay-per-click',
'SEO' => 'Search engine optimization',
'Social' => '',
'Email' => '',
'Traditional' => ''
}
end
|
#database_schema_prefix ⇒ Object
82
83
84
|
# File 'lib/landable/configuration.rb', line 82
def database_schema_prefix
@database_schema_prefix ||= ''
end
|
#dnt_enabled ⇒ Object
170
171
172
173
|
# File 'lib/landable/configuration.rb', line 170
def dnt_enabled
return true if @dnt_enabled.nil?
@dnt_enabled
end
|
#partials_to_templates ⇒ Object
102
103
104
|
# File 'lib/landable/configuration.rb', line 102
def partials_to_templates
@partials_to_templates ||= []
end
|
#public_host ⇒ Object
70
71
72
|
# File 'lib/landable/configuration.rb', line 70
def public_host
@public_host ||= public_uri.try(:host)
end
|
#public_namespace ⇒ Object
78
79
80
|
# File 'lib/landable/configuration.rb', line 78
def public_namespace
@public_namespace ||= (public_uri.try(:path).presence || '')
end
|
#public_url ⇒ Object
Returns the value of attribute public_url.
5
6
7
|
# File 'lib/landable/configuration.rb', line 5
def public_url
@public_url
end
|
#publicist_url ⇒ Object
50
51
52
|
# File 'lib/landable/configuration.rb', line 50
def publicist_url
@publicist_url ||= 'publicist.dev'
end
|
#reserved_paths ⇒ Object
106
107
108
|
# File 'lib/landable/configuration.rb', line 106
def reserved_paths
@reserved_paths ||= []
end
|
#screenshots_enabled ⇒ Object
122
123
124
|
# File 'lib/landable/configuration.rb', line 122
def screenshots_enabled
@screenshots_enabled ||= false
end
|
#sitemap_additional_paths ⇒ Object
114
115
116
|
# File 'lib/landable/configuration.rb', line 114
def sitemap_additional_paths
@sitemap_additional_paths ||= []
end
|
#sitemap_exclude_categories ⇒ Object
110
111
112
|
# File 'lib/landable/configuration.rb', line 110
def sitemap_exclude_categories
@sitemap_exclude_categories ||= []
end
|
#sitemap_host ⇒ Object
Returns the value of attribute sitemap_host.
5
6
7
|
# File 'lib/landable/configuration.rb', line 5
def sitemap_host
@sitemap_host
end
|
#sitemap_protocol ⇒ Object
118
119
120
|
# File 'lib/landable/configuration.rb', line 118
def sitemap_protocol
@sitemap_protocol ||= 'http'
end
|
#traffic_enabled ⇒ Object
126
127
128
|
# File 'lib/landable/configuration.rb', line 126
def traffic_enabled
@traffic_enabled ||= false
end
|
#untracked_paths ⇒ Object
166
167
168
|
# File 'lib/landable/configuration.rb', line 166
def untracked_paths
@untracked_paths ||= []
end
|
Instance Method Details
#api_uri ⇒ Object
54
55
56
|
# File 'lib/landable/configuration.rb', line 54
def api_uri
@api_uri ||= URI(api_url) if api_url.present?
end
|
#authenticators ⇒ Object
40
41
42
|
# File 'lib/landable/configuration.rb', line 40
def authenticators
@authenticators || fail('No Landable authenticator configured.')
end
|
#authenticators=(authenticators) ⇒ Object
Also known as:
authenticator=
44
45
46
|
# File 'lib/landable/configuration.rb', line 44
def authenticators=(authenticators)
@authenticators = Array(authenticators)
end
|
#cors ⇒ Object
135
136
137
|
# File 'lib/landable/configuration.rb', line 135
def cors
@cors ||= CORS.new
end
|
#cors=(bool) ⇒ Object
139
140
141
142
|
# File 'lib/landable/configuration.rb', line 139
def cors=(bool)
fail(ArgumentError, "Landable::Configuration#cors should be assigned 'false' to disable CORS support") if bool != false
cors.origins = []
end
|
#public_uri ⇒ Object
66
67
68
|
# File 'lib/landable/configuration.rb', line 66
def public_uri
@public_uri ||= URI(public_url) if public_url.present?
end
|
#screenshots ⇒ Object
158
159
160
|
# File 'lib/landable/configuration.rb', line 158
def screenshots
@screenshots ||= Screenshots.new
end
|