-
Notifications
You must be signed in to change notification settings - Fork 536
QConf LuaJit Doc
- Build luajit extension
cp qconf.lua LuaJit_dir/share/lua/5.1/
- include the qconf.lua
local qconf = require('qconf')
err, value = qconf.get_conf(path, idc)
Description
get configure value
Parameters
path - key of configuration.
idc - Optional,from which idc to get the value,get from local idc if omit
Return Value
err - error code, 0 means success; others mean fail
value - if err == 0, then it is configure of current path; if err != 0, it is detailed information of current error code
Example
local err, value = qconf.get_conf(key)
err, value = qconf.get_batch_keys(path, idc);
Description
get all children nodes'key
Parameters
path - key of configuration.
idc - Optional,from which idc to get the keys,get from local idc if omit
Return Value
err - error code, 0 means success; others mean fail
value - if err == 0, then it is children nodes of current path; if err != 0, it is detailed information of current error code
Example
err, keys = qconf.get_batch_keys(key)
for 1, #(keys) in keys do
-- do something
done
err, value = qconf.get_batch_conf(path, idc);
Description
get all children nodes' key and value
Parameters
path - key of configuration.
idc - Optional, from which idc to get the children configurations,get from local idc if omit
Return Value
err - error code, 0 means success; others mean fail
value - if err == 0, then it is children nodes' key and value of current path; if err != 0, it is detailed information of current error code
Example
err, children = qconf.get_batch_conf(key)
for k, v in pairs(children) do
-- do something
done
err, value = qconf.get_allhost(path, idc);
Description
get all available services under given path
Parameters
path - key of configuration. idc - Optional, from which idc to get the services,get from local idc if omit
Return Value
err - error code, 0 means success; others mean fail
value - if err == 0, then it is available services of current path; if err != 0, it is detailed information of current error code
Example
err, hosts = qconf.get_allhost(key)
for 1, #(hosts) in hosts do
-- do something
done
err, value = qconf.get_host(path, idc);
Description
get one available service
Parameters
path - key of configuration.
idc - Optional,from which idc to get the host,get from local idc if omit
Return Value
err - error code, 0 means success; others mean fail
value - if err == 0, then it is one available service of current path; if err != 0, it is detailed information of current error code
Example
err, host = qconf.get_host(key)
local qconf = require('qconf')
local err, value = qconf.get_conf(key)
if err == 0 then
print("value: " .. value)
end
local err, children = qconf.get_batch_conf(key)
if err == 0 then
for k, v in pairs(children) do
print(k)
print(v)
end
end
local err, keys = qconf.get_batch_keys(key)
if err == 0 then
for v = 1, #(keys) do
print(keys[v])
end
end
local err, hosts = qconf.get_allhost(key)
if err == 0 then
for v = 1, #(hosts) do
print(hosts[v])
end
end
local err, host = qconf.get_host(key)
if err == 0 then
print(host)
end
- QConf Wiki
- FAQ
- Nginx 配置文件 脚本更新说明
- QConf 保证数据的正确性方法
- QConf 使用场景
- QConf 反馈服务器简单示例
- QConf 架构
- QConf 灰度发布功能说明
- QConf 简易部署和使用
- QConf monitor简易部署使用
- QConf Document
- QConf C\C++ Doc
- QConf Go Doc
- QConf Java Doc
- QConf LuaJit Doc
- QConf Node Doc
- QConf Perl Doc
- QConf PHP Doc
- QConf Python Doc
- QConf 管理端
- QConf 管理界面使用
- QConf 管理端接口(C )
- QConf 管理端接口(PHP)