28 lines
709 B
Lua
28 lines
709 B
Lua
local createSandbox = require('/apis/libsandbox');
|
|
local createVersion = require('/apis/libversion');
|
|
|
|
local URL_SETTING = 'sandbox.url';
|
|
local PASSWORD_SETTING = 'sandbox.password';
|
|
|
|
local url = settings.get(URL_SETTING);
|
|
if type(url) ~= 'string' or url == '' then
|
|
print('sandbox: ' .. URL_SETTING .. ' not set, daemon inactive.');
|
|
return;
|
|
end
|
|
|
|
if not http or not http.websocket then
|
|
print('sandbox: HTTP/WebSocket unavailable, daemon inactive.');
|
|
return;
|
|
end
|
|
|
|
local secret = settings.get(PASSWORD_SETTING);
|
|
|
|
createSandbox().startSession({
|
|
eventloop = _G.bootEventLoop,
|
|
url = url,
|
|
secret = secret,
|
|
os = os,
|
|
});
|
|
|
|
print('sandbox v' .. createVersion().forSelf() .. ' started (' .. url .. ').');
|