index.js
function HAProxy(socket, options) {
  if (!(this instanceof HAProxy)) return new HAProxy(socket, options);

  options = options || {};

  //
  // Allow variable arguments, with socket path or just custom options.
  //
  if ('object' === typeof socket) {
    options = socket;
    socket = options.socket || null;
  }

  this.socket = socket || '/tmp/haproxy.sock';                // Path to socket
  this.cfg = options.config || '/etc/haproxy/haproxy.cfg'; // Config location

  //
  // Create a new `haproxy` orchestrator which interacts with the binary.
  //
  this.orchestrator = new Orchestrator({
    discover: options.discover,
    pidFile: options.pidFile,
    prefix: options.prefix,
    which: options.which,
    pid: options.pid,
    config: this.cfg
  });
}
function HAProxy(socket, options) {
  if (!(this instanceof HAProxy)) return new HAProxy(socket, options);

  options = options || {};

  //
  // Allow variable arguments, with socket path or just custom options.
  //
  if ('object' === typeof socket) {
    options = socket;
    socket = options.socket || null;
  }

  this.socket = socket || '/tmp/haproxy.sock';                // Path to socket
  this.cfg = options.config || '/etc/haproxy/haproxy.cfg'; // Config location

  //
  // Create a new `haproxy` orchestrator which interacts with the binary.
  //
  this.orchestrator = new Orchestrator({
    discover: options.discover,
    pidFile: options.pidFile,
    prefix: options.prefix,
    which: options.which,
    pid: options.pid,
    config: this.cfg
  });
}
function HAProxy ( socket , options ) { if ( ! ( this instanceof HAProxy ) ) return new HAProxy ( socket , options ) ; options = options || { } ; // // Allow variable arguments, with socket path or just custom options. // if ( 'object' === typeof socket ) { options = socket ; socket = options . socket || null ; } this . socket = socket || '/tmp/haproxy.sock' ; // Path to socket this . cfg = options . config || '/etc/haproxy/haproxy.cfg' ; // Config location // // Create a new `haproxy` orchestrator which interacts with the binary. // this . orchestrator = new Orchestrator ( { discover : options . discover , pidFile : options . pidFile , prefix : options . prefix , which : options . which , pid : options . pid , config : this . cfg } ) ; }
Control your HAProxy servers using the unix domain socket. This module is
based upon the 1.5 branch socket.

Options:

- pid: The process id
- pidFile: The location of the pid file
- config: The location of the configuration file
- discover: Tries to find your HAProxy instance if you don't know the pid
- socket: The location of the unix socket
- [optional] which: The location of the haproxy

@see http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.2

@constructor
@param {String} socket Path to the unix domain socket
@param {Object} options Configuration
@api public
Control your HAProxy servers using the unix domain socket . This module is based upon the 1 . 5 branch socket .