plugin/vhosting: added 'block' option
Massimo Melina committed
May 1, 2022 at 00:42 UTC
5457d7946d1bbc0376ed7a9984cf6a74778b5255
1 file changed
+10
-2
plugins/vhosting/plugin.js
+10
-2
@@ -1,5 +1,5 @@
1
exports.description = "If you want to have different home folders, based on domain"
2
-exports.version = 1
2
+exports.version = 2 // added config.mandatory
3
exports.apiRequired = 2 // 2 is for the config 'array'
4
5
exports.config = {
@@ -12,7 +12,11 @@ exports.config = {
12
},
13
defaultValue: [],
14
height: 300,
15
- }
15
+ },
16
+ mandatory: {
17
+ label: "Block requests that are not using any of the domains above",
18
+ type: 'boolean',
19
+ }
20
}
21
22
exports.init = api => ({
@@ -30,5 +34,9 @@ exports.init = api => ({
34
toModify.path = row.root + toModify.path
35
return
36
}
37
+ if (api.getConfig('mandatory')) {
38
+ ctx.socket.destroy()
39
+ return true
40
+ }
41
}
42
})