Commit 77616841 authored by Marek Vavruša's avatar Marek Vavruša

daemon: modules = { mod = 'abc' } and mod.config('abc') are equal

parent 9e493493
......@@ -89,6 +89,9 @@ Notice the absence of an interactive CLI. You can attach to the the consoles for
> cache.count()
53
The *direct output* of the CLI command is captured and sent over the socket, while also printed to the daemon standard outputs (for accountability). This gives you an immediate response on the outcome of your command.
Error or debug logs aren't captured, but you can find them in the daemon standard outputs.
This is also a way to enumerate and test running instances, the list of files int ``tty`` correspond to list
of running processes, and you can test the process for liveliness by connecting to the UNIX socket.
......@@ -149,9 +152,7 @@ the modules use as the :ref:`input configuration <mod-properties>`.
modules = {
cachectl = true,
hints = { -- with configuration
file = '/etc/hosts'
}
hints = '/etc/hosts'
}
.. tip:: The configuration and CLI syntax is Lua language, with which you may already be familiar with.
......
......@@ -45,11 +45,12 @@ setmetatable(modules, {
if type(k) == 'number' then k = v end
if not rawget(_G, k) then
modules.load(k)
local mod = rawget(_G, k)
if k ~= v and mod and mod['config'] then
mod['config'](v)
local mod = _G[k]
if mod and mod['config'] then
if k ~= v then mod['config'](v)
else mod['config']()
end
end
end
end
})
......
......@@ -340,7 +340,8 @@ const knot_layer_api_t *hints_layer(struct kr_module *module)
int hints_init(struct kr_module *module)
{
return load(module, DEFAULT_FILE);
module->data = NULL;
return 0;
}
int hints_config(struct kr_module *module, const char *conf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment