[Groonga-commit] droonga/droonga-http-server at b3c4d70 [master] Accept integer options correctly

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Sep 19 20:48:54 JST 2014


YUKI Hiroshi	2014-09-19 20:48:54 +0900 (Fri, 19 Sep 2014)

  New Revision: b3c4d7079f5448c5fd212a43823553567227398c
  https://github.com/droonga/droonga-http-server/commit/b3c4d7079f5448c5fd212a43823553567227398c

  Message:
    Accept integer options correctly

  Modified files:
    bin/droonga-http-server-configure

  Modified: bin/droonga-http-server-configure (+24 -3)
===================================================================
--- bin/droonga-http-server-configure    2014-09-19 20:47:57 +0900 (0f20d4c)
+++ bin/droonga-http-server-configure    2014-09-19 20:48:54 +0900 (f8f0e17)
@@ -204,6 +204,27 @@ function setString(name, message) {
  });
 }
 
+function setInteger(name, message) {
+ return Q.Promise(function(resolve, reject, notify) {
+  if (options[name + 'Given'] || options.quiet) {
+    configValues[name] = options[name];
+    resolve();
+  }
+  else {
+    promptly.prompt(message + ' [' + options[name] + ']: ',
+                    { default: options[name],
+                      retry:   false },
+                    function(error, value) {
+                      value = parseInt(value);
+                      if (isNaN(value))
+                        value = options[name];
+                      configValues[name] = value;
+                      resolve();
+                    });
+  }
+ });
+}
+
 function setBoolean(name, message) {
  return Q.Promise(function(resolve, reject, notify) {
   if (options[name + 'Given'] || options.quiet) {
@@ -234,10 +255,10 @@ function tryResetConfigs() {
     options.environment = 'production';
   }
 
-  setString('port', 'port')
+  setInteger('port', 'port')
    .then(function() { return setString('receiverHostName', 'hostname of this node'); })
    .then(function() { return setString('droongaEngineHostName', 'hostname of the droonga-engine node'); })
-   .then(function() { return setString('droongaEnginePort', 'port number of the droonga-engine node'); })
+   .then(function() { return setInteger('droongaEnginePort', 'port number of the droonga-engine node'); })
    .then(function() { return setString('tag', 'tag of the droonga-engine node'); })
    .then(function() { return setString('defaultDataset', 'default dataset'); })
    .then(function() {
@@ -263,7 +284,7 @@ function tryResetConfigs() {
          return setString('pidFile', 'path to the PID file');
      }
    })
-   .then(function() { return setString('cacheSize', 'maximum size of the response cache'); })
+   .then(function() { return setInteger('cacheSize', 'maximum size of the response cache'); })
    .then(function() { return setBoolean('enableTrustProxy', 'enable "trust proxy" configuration'); })
    .then(function() { return setString('environment', 'environment'); })
    .then(resolve);
-------------- next part --------------
HTML����������������������������...
Télécharger 



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