REST 参数
xSQL 配置文件可用于运行嵌入式 REST 服务器并公开 Web 服务 REST API。
其余部分由一组用大括号括起来的“名称:值”对组成。例如:
rest : {
addr : 192.168.0.5,
port : 8083,
# HTTP basic authentication parameters. Authentication is disabled
# if these parameters are not set.
http_realm: "WebAPI",
http_username: "user",
http_password: "pass",
# REST-specific SSL settings. See the global ssl_params section
# for the description of the parameters and their default values.
# These parameters override the global settings.
# To inherit the global ssl_params settings, leave the ssl_params section empty.
ssl_params : {
cipher_list : "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4",
max_cert_list : 102400,
verify_mode : [verify_none],
verify_depth : 100,
cert_file_pem : "restcert.pem",
pkey_file_pem : "restkey.pem"
},
},
...
以下列出了休息部分的可能选项:
addr
addr : 192.168.0.5,
设置监听地址。如果省略此参数,其默认值为 0.0.0.0,这会使 REST 服务器接受所有网络接口(局域网、WiFi 等已安装的接口)上的传入连接。这种默认行为可能不理想,甚至存在危险。若要限制网络访问,可以指定任何有效的 IP 地址。
port
port : 8083,
设置嵌入式 REST 服务器的端口
http_realm
http_realm: "WebAPI",
身份验证领域(最多 15 个字符)
http_username
http_username: "user",
身份验证用户名(最多 15 个字符)
http_password
http_password: "pass",
验证密码(最多 31 个字符)
ssl_params
ssl_params : {...}
特定于 REST 的 SSL 设置。有关参数及其默认值的说明,请参阅全局 ssl_params 部分。这些参数会覆盖全局设置。如果省略此部分,则使用全局 ssl_params 设置。(它们具有与全局部分相同的参数和默认值,但 ca_path 和 ca_file 仅允许在全局部分中使用。)