mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +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 allowScriptFilesystemAccess = get(scriptingConfig, 'filesystemAccess.allow', false);
|
||||
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 = {};
|
||||
|
||||
@ -181,7 +186,7 @@ class ScriptRuntime {
|
||||
require: {
|
||||
context: 'sandbox',
|
||||
external: true,
|
||||
root: [collectionPath],
|
||||
root: [collectionPath, ...additionalContextRootsAbsolute],
|
||||
mock: {
|
||||
// node libs
|
||||
path,
|
||||
|
Loading…
Reference in New Issue
Block a user