configuration - noradle/noradle-dispatcher GitHub Wiki

configuration of noradle-dispatcher have 3 parts

  • listening address configurations, can listen to http,https,unix-pipe
  • client/oracle/console authentication configuration
  • client concurrent slots configuration

noradle-dispatcher have a minimised core.

如果

  • 监听地址只通过命令行支持 http/https/pipe 三种方式,每种方式只允许监听一个地址
  • oracle 给予各个 client 的虚拟并发数都在 oracle 配置并且给与到 dispatcher
  • dispatcher 只配置各个终端是否允许访问,可以不设置配置文件或者实现验证接口的module

那么 noradle-dispatcher 可以说基本上就不用配置文件,只需要用命令行参数启动即可。

todo:

  • 实现默认连接验证只看客户端IP,如果ip实在同一个局域网,则通过
  • 如滚配置 -a --auth
    • 可以是目录、js文件、JSON文件
      it can be a directory, js file, JSON file
    • 只要require完,.auth 是一个函数,就是用函数验证
      if require(path).auth is function, it must implement function(role,name,pass,cip,secure)
    • 如果 require 完, .auth 得到是一个 object,就是标准格式的权限配置文件,通常放到 pm2.json 中
      if require(path).auth is object, it must be a static authentication configuration file, normally in pm2.json

监听端口配置

  • http 监听端口配置,host:port,其中 host 可以为空,代表不限地址,也即 0.0.0.0
  • https 监听端口配置,格式同上
  • https cert,用户 http.createServer(options, ...)

客户端认证控制

  • 在配置对象的 clients 中配置,格式如
{
  clients: {
    'demo' : {
      passwd: ...,
      cip: string or regexp
    }

oracle认证控制

认证控制的简化

  • config.auth 如果是 function(role,name,pass,cip) 即可
  • 如果是 object,则是静态配置

keep-alive ping/pong 间隔控制

配置从 oracle 下放

客户端认证

访问到本库的每个客户端的 cid/passwd/cip 认证,允许访问的 dbu 限制,都可以下放到 dispatcher/client 中去,这样就免去了在 dispatcher 配置。

但是这个比较复杂,客户端连接后,还需要等待通道访问 oracle 获取配置,然后才能进行认证。 中间可能会出现网络超时异常。

因此最多是应该 dispatcher 本地配置,然后可以从 oracle 侧自动更新本地配置。