8000 Allow running arbitrary Foxx scripts. · cloud-coders/arangodb@b26b469 · GitHub
[go: up one dir, main page]

Skip to content

Commit b26b469

Browse files
committed
Allow running arbitrary Foxx scripts.
1 parent 76235a7 commit b26b469

File tree

9 files changed

+1506
-1369
lines changed

9 files changed

+1506
-1369
lines changed

js/apps/system/_admin/aardvark/APP/foxxes.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"The mount point of the app. Has to be url-encoded."
4444
)
4545
};
46+
var scriptName = {
47+
type: joi.string().required().description(
48+
"The name of an app's script to run."
49+
)
50+
};
4651
var fs = require("fs");
4752
var defaultThumb = require("/lib/defaultThumbnail").defaultThumb;
4853

@@ -212,13 +217,24 @@
212217
res.json(FoxxManager.configure(mount, {configuration: data}));
213218
}).queryParam("mount", mountPoint);
214219

220+
221+
/** Run a script for an app
222+
*
223+
* Used to trigger any script of an app
224+
*/
225+
controller.post("/scripts/:name", function (req, res) {
226+
var mount = validateMount(req);
227+
var name = req.params("name");
228+
res.json(FoxxManager.runScript(name, mount));
229+
}).queryParam("mount", mountPoint).pathParam("name", scriptName);
230+
215231
/** Trigger setup script for an app
216232
*
217233
* Used to trigger the setup script of an app
218234
*/
219235
controller.patch("/setup", function(req, res) {
220236
var mount = validateMount(req);
221-
res.json(FoxxManager.setup(mount));
237+
res.json(FoxxManager.runScript("setup", mount));
222238
}).queryParam("mount", mountPoint);
223239

224240
/** Trigger teardown script for an app
@@ -227,7 +243,7 @@
227243
*/
228244
controller.patch("/teardown", function(req, res) {
229245
var mount = validateMount(req);
230-
res.json(FoxxManager.teardown(mount));
246+
res.json(FoxxManager.runScript("teardown", mount));
231247
}).queryParam("mount", mountPoint);
232248

233249

0 commit comments

Comments
 (0)
0