mirror of https://gitee.com/bigwinds/arangodb
Mount all system apps on startup
This commit is contained in:
parent
9969a6e4f2
commit
f56c47647d
|
@ -1221,6 +1221,13 @@ exports.initializeFoxx = function () {
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
var appCache = {};
|
var appCache = {};
|
||||||
|
var usedSystemMountPoints = [
|
||||||
|
"/_admin/aardvark", // Admin interface.
|
||||||
|
"/_system/cerberus", // Password recovery.
|
||||||
|
"/_api/gharial", // General_Graph API.
|
||||||
|
"/_system/sessions", // Sessions.
|
||||||
|
"/_system/simple-auth" // Authentication.
|
||||||
|
];
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private functions
|
// --SECTION-- private functions
|
||||||
|
@ -1246,6 +1253,21 @@ exports.initializeFoxx = function () {
|
||||||
return routes;
|
return routes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief Makes sure all system apps are mounted.
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
var checkMountedSystemApps = function() {
|
||||||
|
var i, mount;
|
||||||
|
for (i = 0; i < usedSystemMountPoints.length; ++i) {
|
||||||
|
mount = usedSystemMountPoints[i];
|
||||||
|
if (!appCache[mount]) {
|
||||||
|
// System app not written to collection
|
||||||
|
_scanFoxx(mount, {});
|
||||||
|
setup(mount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief lookup app in cache
|
/// @brief lookup app in cache
|
||||||
/// Returns either the app or undefined if it is not cached.
|
/// Returns either the app or undefined if it is not cached.
|
||||||
|
@ -1696,15 +1718,29 @@ exports.initializeFoxx = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief Internal scanFoxx function. Check scanFoxx.
|
||||||
|
/// Does not check parameters and throws errors.
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var _scanFoxx = function(mount, options) {
|
||||||
|
delete appCache[mount];
|
||||||
|
var app = createApp(mount, options);
|
||||||
|
utils.tmp_getStorage().save(app.toJSON());
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief Scans the sources of the given mountpoint and publishes the routes
|
/// @brief Scans the sources of the given mountpoint and publishes the routes
|
||||||
///
|
///
|
||||||
/// TODO: Long Documentation!
|
/// TODO: Long Documentation!
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
var scanFoxx = function(mount, options) {
|
var scanFoxx = function(mount, options) {
|
||||||
delete appCache[mount];
|
checkParameter(
|
||||||
var app = createApp(mount, options);
|
"mount(<mount>)",
|
||||||
utils.tmp_getStorage().save(app.toJSON());
|
[ [ "Mount path", "string" ] ],
|
||||||
|
[ mount ] );
|
||||||
|
_scanFoxx(mount, options);
|
||||||
|
executeGlobalContextFunction("reloadRouting");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1736,7 +1772,7 @@ exports.initializeFoxx = function () {
|
||||||
// try appstore
|
// try appstore
|
||||||
throw "Not implemented yet";
|
throw "Not implemented yet";
|
||||||
}
|
}
|
||||||
scanFoxx(mount, options);
|
_scanFoxx(mount, options);
|
||||||
if (runSetup) {
|
if (runSetup) {
|
||||||
setup(mount);
|
setup(mount);
|
||||||
}
|
}
|
||||||
|
@ -1825,7 +1861,8 @@ exports.initializeFoxx = function () {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var initializeFoxx = function() {
|
var initializeFoxx = function() {
|
||||||
return refillCaches(false);
|
refillCaches(false);
|
||||||
|
checkMountedSystemApps();
|
||||||
};
|
};
|
||||||
|
|
||||||
var appRoutes = function() {
|
var appRoutes = function() {
|
||||||
|
|
Loading…
Reference in New Issue