-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.lsp
75 lines (57 loc) · 2.12 KB
/
index.lsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?lsp
local ua = require("opcua.api")
local localServer = io:dofile("local_server.lua")
local examples_root = mako.getapps()[1]
local servers = {
{path=examples_root.."/client/auth_username", isLocal=true},
{path=examples_root.."/client/auth_x509", isLocal=true},
{path=examples_root.."/client/start", isLocal=true},
{path=examples_root.."/servers/write_data"},
{path=examples_root.."/servers/server_http"},
{path=examples_root.."/servers/server_config"},
{path=examples_root.."/servers/server_basic128rsa15"},
{path=examples_root.."/servers/read_data"},
{path=examples_root.."/servers/embed_web_server"},
{path=examples_root.."/servers/data_source"},
{path=examples_root.."/servers/add_nodes"},
{path=examples_root.."/servers/start"},
{path=examples_root.."/servers/server_config"},
{path=examples_root.."/servers/browse"},
}
local function FailIfError(err)
if type(err) == 'string' then
trace("--------------------------------------------------------")
trace("--------------- !!!!!! FAIL !!!!!!-----------------------")
trace("--------------------------------------------------------")
trace("Error: " .. tostring(err))
os.exit(-1)
end
end
for i, server in ipairs(servers) do
trace("--------------------------------------------------------")
local appName = "server_"..i
trace(string.format("loading app %s: '%s'", appName, server.path))
if server.isLocal then
local result, err = localServer.start()
FailIfError(err)
err = nil
end
local result, err = mako.createapp(appName, 0, server.path)
FailIfError(err)
err = nil
trace("stopping app '" .. appName.."'")
local result, err = mako.stopapp(2)
trace("stopping app '" .. appName.."'")
local result, err = mako.removeapp(2)
if server.isLocal then
local result, err = localServer.stop()
FailIfError(err)
err = nil
end
trace("--------------------------------------------------------")
end
trace("--------------------------------------------------------")
trace("--------------- SUCCESS -----------------------")
trace("--------------------------------------------------------")
os.exit(0)
?>