diff --git a/README.md b/README.md index dae4deb..c5bd565 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ initialization will run validation of your configuration file and check if it is valid. if it is not you will see logs emitted about what failed when a request comes in, the scripts declared in the aproxy config file will -be executed sequentially in the order they appear in the configuration. +be executed sequentially (TODO: ensure order on conf file is chain order). each script has two types of callbacks: init and request diff --git a/conf.lua b/conf.lua index 13e9e98..ee662d7 100644 --- a/conf.lua +++ b/conf.lua @@ -1,11 +1,6 @@ return { version = 1, wantedScripts = { - { - name = 'webfinger_allowlist', - config = { - accounts = {"example@example.com"} - } - } + ['webfinger_allowlist'] = {accounts = {"example@example.com"}} } } diff --git a/config.lua b/config.lua index a8417a2..0de4de9 100644 --- a/config.lua +++ b/config.lua @@ -84,9 +84,7 @@ end local function validateConfigFile(config_object) local all_schema_errors = {} - for _, script_entry in ipairs(config_object.wantedScripts) do - local module_name = script_entry.name - local module_config = script_entry.config + for module_name, module_config in pairs(config_object.wantedScripts) do local module_manifest = require('scripts.' .. module_name) local config_schema = module_manifest.config local schema_errors = validateSchema(config_schema, module_config) diff --git a/ctx.lua b/ctx.lua index 2ab470e..fb43089 100644 --- a/ctx.lua +++ b/ctx.lua @@ -18,9 +18,7 @@ end function ctx:loadChain() self.compiled_chain = {} - for _, script_entry in ipairs(self._wanted_scripts) do - local module_name = script_entry.name - local module_config = script_entry.config + for module_name, module_config in pairs(self._wanted_scripts) do local module = require('scripts.' .. module_name) local module_config_readonly = table.readonly(module_config) local module_state = module.init(module_config_readonly)