Module: Contentful::Moderator
- Defined in:
- lib/contentful/moderator.rb,
lib/contentful/moderator/config.rb,
lib/contentful/moderator/version.rb,
lib/contentful/moderator/controller.rb
Defined Under Namespace
Classes: Config, Controller
Constant Summary
collapse
- VERSION =
"0.1.0"
- @@config =
nil
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
16
17
18
|
# File 'lib/contentful/moderator.rb', line 16
def self.config
@@config
end
|
.config=(config) ⇒ Object
.start(config = {}) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/contentful/moderator.rb', line 20
def self.start(config = {})
fail "Moderator not configured" if config.nil? && !block_given?
if block_given?
yield(config) if block_given?
end
self.config = config
logger = Logger.new(STDOUT)
::Contentful::Webhook::Listener::Server.start do |server_config|
server_config[:port] = config.port
server_config[:logger] = logger
server_config[:endpoints] = [
{
endpoint: config.endpoint,
controller: ::Contentful::Moderator::Controller,
timeout: 0
}
]
end.join
end
|