[Groonga-commit] droonga/express-droonga at 5755d41 [master] Make host, port, and tag can be overridden.

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Jan 16 16:25:15 JST 2014


YUKI Hiroshi	2014-01-16 16:25:15 +0900 (Thu, 16 Jan 2014)

  New Revision: 5755d41e15be2c2a9fd55319811849cbf943af49
  https://github.com/droonga/express-droonga/commit/5755d41e15be2c2a9fd55319811849cbf943af49

  Message:
    Make host, port, and tag can be overridden.
    
    Priority:
    env.DROONGA_ENGINE_DEFAULT_DATASET => "defaultDataset" option
    env.DROONGA_ENGINE_HOST => "hostName" option
    env.DROONGA_ENGINE_PORT => "port" option
    env.DROONGA_ENGINE_TAG  => "tag" option
    env.DROONGA_ENGINE_RECEIVE_HOST => "receiveHost" option
    env.DROONGA_ENGINE_RECEIVE_PORT => "receivePort" option

  Modified files:
    lib/droonga-protocol/connection.js

  Modified: lib/droonga-protocol/connection.js (+17 -6)
===================================================================
--- lib/droonga-protocol/connection.js    2014-01-15 16:03:41 +0900 (5448e3e)
+++ lib/droonga-protocol/connection.js    2014-01-16 16:25:15 +0900 (4a0708f)
@@ -46,15 +46,23 @@ Connection.prototype._init = function() {
   this.closed = false;
   this._callbacks = {};
   this._id = Date.now();
-  this.tag = this._params.tag || DEFAULT_FLUENT_TAG;
-  this.defaultDataset = this._params.defaultDataset || '';
+  this.tag = process.env.DROONGA_ENGINE_TAG ||
+               this._params.tag ||
+                 DEFAULT_FLUENT_TAG;
+  this.defaultDataset = process.env.DROONGA_ENGINE_DEFAULT_DATASET ||
+                          this._params.defaultDataset ||
+                            '';
   this._initSender();
   this._initReceiver();
 };
 
 Connection.prototype._initSender = function(wait) {
-  var options = { host: this._params.hostName || DEFAULT_FLUENT_HOST_NAME,
-                  port: this._params.port || DEFAULT_FLUENT_PORT };
+  var options = { host: process.env.DROONGA_ENGINE_HOST ||
+                          this._params.hostName ||
+                            DEFAULT_FLUENT_HOST_NAME,
+                  port: process.env.DROONGA_ENGINE_PORT ||
+                          this._params.port ||
+                            DEFAULT_FLUENT_PORT };
   var sender = fluent.createFluentSender(this.tag, options);
   this._sender = sender;
   this._sender.on('error', (function(error) {
@@ -63,8 +71,11 @@ Connection.prototype._initSender = function(wait) {
 };
 
 Connection.prototype._initReceiver = function() {
-  this.receiveHostName = this._params.receiveHostName || DEFAULT_RECEIVE_HOST_NAME;
-  this.receivePort = this._params.receivePort;
+  this.receiveHostName = process.env.DROONGA_ENGINE_RECEIVE_HOST ||
+                           this._params.receiveHostName ||
+                             DEFAULT_RECEIVE_HOST_NAME;
+  this.receivePort = process.env.DROONGA_ENGINE_RECEIVE_PORT ||
+                       this._params.receivePort;
 
   var receiver = new FluentReceiver(this.receivePort);
   receiver.listen((function() {
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index