-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathclient.lua
More file actions
executable file
·34 lines (25 loc) · 773 Bytes
/
client.lua
File metadata and controls
executable file
·34 lines (25 loc) · 773 Bytes
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
#!/usr/bin/env tarantool
local listen = os.getenv('TNT_LISTEN_URI')
box.cfg {
listen = (listen == '' or listen == nil) and 3301 or listen,
log_level = 6,
}
box.schema.user.grant('guest', 'read,write,execute,create,drop,alter', 'universe', nil, {if_not_exists = true})
function try_drop_user(username)
if box.schema.user.exists(username) then
box.schema.user.drop(username)
end
end
function create_user(username, password)
try_drop_user(username)
return box.schema.user.create(username, {password = password})
end
function try_drop_space(name)
if box.space[name] then
box.space[name]:drop()
end
end
function create_space(name)
try_drop_space(name)
return box.schema.space.create(name, {temporary = true})
end