Skip to content

Commit

Permalink
fix: pre-hotreload cartridge support
Browse files Browse the repository at this point in the history
`crud` module is cartridge-independent in nature, but provides cartridge
roles which are the most popular way to setup the module. The roles also
not use any modern cartridge features and should work with any cartridge
version. But since crud.cfg was introduced [1], it was required to add
some code for roles reload [2] proper support. Now
cartridge.hotreload module is unconditionally required, so roles cannot
be used with cartridge older than 2.4.0. This patch fixes the behavior.

1. 6da4f56
2. tarantool/cartridge@941952e

Follows #244
  • Loading branch information
DifferentialOrange committed Feb 3, 2023
1 parent bd39ec8 commit 77ea64d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed
* Pre-hotreload `cartridge` support (older than 2.4.0) (PR #341).

## [1.0.0] - 02-02-23

### Added
Expand Down
6 changes: 5 additions & 1 deletion crud/common/stash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ stash.name = {
-- @return Returns
--
function stash.setup_cartridge_reload()
local hotreload = require('cartridge.hotreload')
local hotreload_supported, hotreload = pcall(require, 'cartridge.hotreload')
if not hotreload_supported then
return
end

for _, name in pairs(stash.name) do
hotreload.whitelist_globals({ name })
end
Expand Down

0 comments on commit 77ea64d

Please sign in to comment.