mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
add scripts context to response scripts
This commit is contained in:
parent
b5fccef417
commit
8426c585a4
@ -144,6 +144,11 @@ class ScriptRuntime {
|
|||||||
const res = new BrunoResponse(response);
|
const res = new BrunoResponse(response);
|
||||||
const allowScriptFilesystemAccess = get(scriptingConfig, 'filesystemAccess.allow', false);
|
const allowScriptFilesystemAccess = get(scriptingConfig, 'filesystemAccess.allow', false);
|
||||||
const moduleWhitelist = get(scriptingConfig, 'moduleWhitelist', []);
|
const moduleWhitelist = get(scriptingConfig, 'moduleWhitelist', []);
|
||||||
|
const additionalContextRoots = get(scriptingConfig, 'additionalContextRoots', []);
|
||||||
|
const additionalContextRootsAbsolute = lodash
|
||||||
|
.chain(additionalContextRoots)
|
||||||
|
.map((acr) => (acr.startsWith('/') ? acr : path.join(collectionPath, acr)))
|
||||||
|
.value();
|
||||||
|
|
||||||
const whitelistedModules = {};
|
const whitelistedModules = {};
|
||||||
|
|
||||||
@ -181,7 +186,7 @@ class ScriptRuntime {
|
|||||||
require: {
|
require: {
|
||||||
context: 'sandbox',
|
context: 'sandbox',
|
||||||
external: true,
|
external: true,
|
||||||
root: [collectionPath],
|
root: [collectionPath, ...additionalContextRootsAbsolute],
|
||||||
mock: {
|
mock: {
|
||||||
// node libs
|
// node libs
|
||||||
path,
|
path,
|
||||||
|
Loading…
Reference in New Issue
Block a user