mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
reload plugin when its settings change, fix #262
This commit is contained in:
parent
3468c34b28
commit
93616af565
2 changed files with 14 additions and 1 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 12640461481cc39cdee8efa05e7fd02a6a60e99c
|
||||
Subproject commit c1237728ad0101cc9cab4de3417d323f56abff70
|
|
@ -126,6 +126,19 @@ const settingsController = {
|
|||
async setRequest (req, res) {
|
||||
const { key, value, is_secret } = req.body
|
||||
const ret = await settingsController.set(key, value, is_secret)
|
||||
|
||||
// reload plugin when its settings change
|
||||
if (key.startsWith('plugin_')) {
|
||||
const pluginName = key.slice(7)
|
||||
try {
|
||||
const pluginController = require('./plugins')
|
||||
pluginController.unloadPlugin(pluginName)
|
||||
pluginController.loadPlugin(pluginName)
|
||||
} catch (e) {
|
||||
log.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
if (ret) { res.sendStatus(200) } else { res.sendStatus(400) }
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue