config: allow to call config:get() from app script
It is convenient to access configuration using `config:get()` from the application script (`app.file` or `app.module`). However, before this commit, it was not possible, because the configuration was not considered as applied before the application script is loaded. Now, the script loading is moved into the post-apply phase. The resulting sequence of steps on startup/reload is the following. * collect configuration information (from all the sources) * <if the previous step is failed, set `check_errors` status and break> * apply the configuration (call all the appliers) * <if the previous step is failed, set `check_errors` status and break> * <set the new successful status: `ready` or `check_warnings`> * call post-apply hooks (including application script loading) * <if the previous step is failed, set `check_errors` status and break> * <set the new successful status: `ready` or `check_warnings`> I would like to briefly comment the changes in the tests. * `app_test.lua`: added the check for the new behavior (call config:get() from the app script) * `appliers_test.lua`: fixed the applier call (`.apply` -> `.post_apply`) * `config_test.lua`: fixed status observed in the app script (`*_in_progress` -> `ready`) Part of #8862 NO_DOC=reflected in https://github.com/tarantool/doc/issues/3544
Showing
- changelogs/unreleased/config-get-configuration-from-app.md 4 additions, 0 deletionschangelogs/unreleased/config-get-configuration-from-app.md
- src/box/lua/config/applier/app.lua 8 additions, 3 deletionssrc/box/lua/config/applier/app.lua
- src/box/lua/config/init.lua 36 additions, 22 deletionssrc/box/lua/config/init.lua
- test/config-luatest/app_test.lua 6 additions, 5 deletionstest/config-luatest/app_test.lua
- test/config-luatest/appliers_test.lua 1 addition, 1 deletiontest/config-luatest/appliers_test.lua
- test/config-luatest/config_test.lua 2 additions, 3 deletionstest/config-luatest/config_test.lua
Please register or sign in to comment