summaryrefslogtreecommitdiffstats
path: root/aconf/model/root.lua
diff options
context:
space:
mode:
Diffstat (limited to 'aconf/model/root.lua')
-rw-r--r--aconf/model/root.lua20
1 files changed, 17 insertions, 3 deletions
diff --git a/aconf/model/root.lua b/aconf/model/root.lua
index 2a135f2..a407b07 100644
--- a/aconf/model/root.lua
+++ b/aconf/model/root.lua
@@ -71,14 +71,28 @@ function M.register(name, field, params)
for _, record in ipairs(node.topology(root:fetch(name))) do
local top = M.topology(record.addr, true)
- local function set(k, v)
- setdefault(top, k, v)
- assert(top[k] == v)
+ local function set(k, v, t)
+ if not t then t = top end
+ setdefault(t, k, v)
+ assert(t[k] == v)
end
set('type', record.type)
+ set('subtype', record.subtype)
table.insert(top.paths, record.path)
+ local mode = record.be_mode
+ if mode then
+ if object.isinstance(
+ mode, require('aconf.path.address.special').SpecialMode
+ ) then
+ mode = {['.']=mode}
+ end
+ for addr, m in pairs(mode) do
+ set('mode', m, addr == '.' and top or top(addr, true))
+ end
+ end
+
if record.scope then
local scope = node.addr(
root:fetch(pth.to_absolute(record.scope, pth.parent(record.path)))