aboutsummaryrefslogtreecommitdiffstats
path: root/core/moduleapi.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/moduleapi.lua')
-rw-r--r--core/moduleapi.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index b11fd7b3..2177378f 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -292,4 +292,18 @@ function api:handle_items(type, added_cb, removed_cb, existing)
end
end
+function api:provides(name, item)
+ if not item then item = self.environment; end
+ if not item.name then
+ local item_name = module.name;
+ -- Strip a provider prefix to find the item name
+ -- (e.g. "auth_foo" -> "foo" for an auth provider)
+ if item_name:find(name.."_", 1, true) == 1 then
+ item_name = item_name:sub(#name+2);
+ end
+ item.name = item_name;
+ end
+ self:add_item(name, item);
+end
+
return api;