Refactored policy structure
Previously, all modules in an org were fully copied into that org. Now, the only copy of the modules is at modpol.modules, and orgs have a policy table at [org].policies, which overrides the config table in any given module.
This commit is contained in:
@ -15,7 +15,7 @@ function modpol.orgs:call_module(module_slug, initiator, config, result, parent_
|
||||
|
||||
local index = #self.processes + 1
|
||||
|
||||
local module = self.modules[module_slug]
|
||||
local module = modpol.modules[module_slug]
|
||||
|
||||
-- first applies any relevant org policies
|
||||
-- then overrides with the config values given on input
|
||||
@ -23,6 +23,11 @@ function modpol.orgs:call_module(module_slug, initiator, config, result, parent_
|
||||
if modpol.util.num_pairs(module.config) > 0 then
|
||||
for k, v in pairs(module.config) do
|
||||
new_config[k] = v
|
||||
-- overrides with org policies
|
||||
if self.policies[module_slug]
|
||||
and self.policies[module_slug][k] then
|
||||
new_config[k] = self.policies[module_slug][k]
|
||||
end
|
||||
-- overrides with input settings
|
||||
if config and config[k] then
|
||||
new_config[k] = config[k]
|
||||
|
Reference in New Issue
Block a user