To create custom policy, adapt the
/opt/msys/ecelerity/etc/sample-configs/custom_policy.lua file and move it to a directory under the
/opt/msys/ecelerity/etc/conf directory. Add the file to the repository as described in Best Practices for Adding Configuration Files.
If you do not implement any custom policy, you need not be concerned with this file. However, you will need to comment out the line,
require("custom_policy"); at the top of the
For your convenience,
custom_policy.lua is reproduced in “The
The default policy looks for custom policy in the msys.db_config.custom_policy namespace. That namespace can contain 'pre' or 'post' callouts for the following hookpoints:
Simply uncomment the phase you are interested in and add appropriate Lua code. For example to execute commands before the default policy actions in validate_data, you would define the pre_validate_data function, with the same parameters as the validate_data function. You may return msys.core.VALIDATE_DONE to terminate processing for that phase, or msys.core.VALIDATE_CONT to continue. The only exception to the return value semantics is the 'init' function, which must return true if successful, or false if there was a failure.
require("custom_policy"); statement appears at the top of the
dp_config.lua file so if you do not include the
custom_policy.lua file in the same directory as
dp_config.lua then you must remove this statement.