def initialize(_args)
Oxidized.mgr = Manager.new
Oxidized.hooks = HookManager.from_config(Oxidized.config)
nodes = Nodes.new
raise NoNodesFound, 'source returns no usable nodes' if nodes.empty?
@worker = Worker.new nodes
@need_reload = false
reload_proc = proc do
@need_reload = true
end
Signals.register_signal('HUP', reload_proc)
if Oxidized.config.has_key? 'rest'
logger.warn(
'configuration: "rest" is deprecated. Migrate to ' \
'"extensions.oxidized-web" and remove "rest" from the configuration'
)
configuration = Oxidized.config.rest
elsif Oxidized.config.extensions['oxidized-web'].load?
configuration = Oxidized.config.extensions['oxidized-web']
end
if configuration
begin
require 'oxidized/web'
rescue LoadError
raise OxidizedError,
'oxidized-web not found: install it or disable it by ' \
'removing "rest" and "extensions.oxidized-web" from your ' \
'configuration'
end
@rest = API::Web.new nodes, configuration
@rest.run
end
run
end