[Groonga-commit] droonga/droonga-http-server at c464228 [master] Ask all configuration values to the user even if their values are given via command line options (#9)

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Nov 4 18:39:08 JST 2014


YUKI Hiroshi	2014-11-04 18:39:08 +0900 (Tue, 04 Nov 2014)

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

  Message:
    Ask all configuration values to the user even if their values are given via command line options (#9)

  Modified files:
    bin/droonga-http-server-configure
    lib/server-options.js

  Modified: bin/droonga-http-server-configure (+3 -3)
===================================================================
--- bin/droonga-http-server-configure    2014-11-04 13:08:47 +0900 (613e45b)
+++ bin/droonga-http-server-configure    2014-11-04 18:39:08 +0900 (c02d49b)
@@ -205,7 +205,7 @@ var configValues = {};
 
 function setStringOption(name, message) {
   return Q.Promise(function(resolve, reject, notify) {
-    if (options[name + 'Given'] || options.quiet) {
+    if (options.quiet) {
       configValues[name] = options[name];
       resolve();
     }
@@ -223,7 +223,7 @@ function setStringOption(name, message) {
 
 function setIntegerOption(name, message) {
   return Q.Promise(function(resolve, reject, notify) {
-    if (options[name + 'Given'] || options.quiet) {
+    if (options.quiet) {
       configValues[name] = options[name];
       resolve();
     }
@@ -244,7 +244,7 @@ function setIntegerOption(name, message) {
 
 function setBooleanOption(name, message) {
   return Q.Promise(function(resolve, reject, notify) {
-    if (options[name + 'Given'] || options.quiet) {
+    if (options.quiet) {
       configValues[name] = options[name];
       resolve();
     }

  Modified: lib/server-options.js (+16 -62)
===================================================================
--- lib/server-options.js    2014-11-04 13:08:47 +0900 (de12bbc)
+++ lib/server-options.js    2014-11-04 18:39:08 +0900 (ed77ecb)
@@ -53,108 +53,62 @@ exports.add = add;
 
 function define() {
   add('--host <host>',
-      'Host to listen (' + options.host + ')',
-      generateOptionHandler(function() {
-        options.hostGiven = true;
-      }));
+      'Host to listen (' + options.host + ')');
   add('--port <port>',
       'Port number (' + options.port + ')',
-      generateOptionHandler(function() {
-        options.portGiven = true;
-      }, intOption));
+      intOption);
   add('--receive-host-name <name>',
       'Host name of the protocol adapter. ' +
         'It must be resolvable by Droonga engine. ' +
-        '(' + options.receiveHostName + ')',
-      generateOptionHandler(function() {
-        options.receiveHostNameGiven = true;
-      }));
+        '(' + options.receiveHostName + ')');
   add('--droonga-engine-host-name <name>',
-      'Host name of Droonga engine (' + options.droongaEngineHostName + ')',
-      generateOptionHandler(function() {
-        options.droongaEngineHostNameGiven = true;
-      }));
+      'Host name of Droonga engine (' + options.droongaEngineHostName + ')');
   add('--droonga-engine-port <port>',
       'Port number of Droonga engine (' + options.droongaEnginePort + ')',
-      generateOptionHandler(function() {
-        options.droongaEnginePortGiven = true;
-      }, intOption));
+      intOption);
   add('--default-dataset <dataset>',
-      'The default dataset (' + options.defaultDataset + ')',
-      generateOptionHandler(function() {
-        options.defaultDatasetGiven = true;
-      }));
+      'The default dataset (' + options.defaultDataset + ')');
   add('--tag <tag>',
-      'The tag (' + options.tag + ')',
-      generateOptionHandler(function() {
-        options.tagGiven = true;
-      }));
+      'The tag (' + options.tag + ')');
   add('--access-log-file <file>',
       'Output access logs to <file>. ' +
         'You can use "-" as <file> to output to the standard output. ' +
-        '(' + options.accessLogFile + ')',
-      generateOptionHandler(function() {
-        options.accessLogFileGiven = true;
-      }));
+        '(' + options.accessLogFile + ')');
   add('--system-log-file <file>',
       'Output system logs to <file>. ' +
         'You can use "-" as <file> to output to the standard output. ' +
-        '(' + options.systemLogFile + ')',
-      generateOptionHandler(function() {
-        options.systemLogFileGiven = true;
-      }));
+        '(' + options.systemLogFile + ')');
   add('--system-log-level <level>',
       'Log level for the system log. ' +
       '[silly,debug,verbose,info|warn,error]' +
-        '(' + options.systemLogLevel + ')',
-      generateOptionHandler(function() {
-        options.systemLogLevelGiven = true;
-      }));
+        '(' + options.systemLogLevel + ')');
   add('--cache-size <size>',
       'The max number of cached requests ' +
         '(' + options.cacheSize + ')',
-      generateOptionHandler(function() {
-        options.cacheSizeGiven = true;
-      }, intOption));
+      intOption);
   add('--enable-trust-proxy',
       'Enable "trust proxy" configuration. It is required when you run droonga-http-server behind a reverse proxy. ' +
-        '(' + options.enableTrustProxy + ')',
-      generateOptionHandler(function() {
-        options.enableTrustProxyGiven = true;
-      }));
+        '(' + options.enableTrustProxy + ')');
   add('--disable-trust-proxy',
       'Inverted option of --enable-trust-proxy.',
       generateOptionHandler(function(newValue) {
         options.enableTrustProxy = !newValue;
-        options.enableTrustProxyGiven = true;
       }));
   add('--plugins <plugin1,plugin2,...>',
       'Use specified plugins. ' +
         '(' + options.plugins.join(',') + ')',
-      generateOptionHandler(function() {
-        options.pluginsGiven = true;
-      }, pluginsOption));
+      pluginsOption);
   add('--daemon',
-      'Run as a daemon. (' + options.daemon + ')',
-      generateOptionHandler(function() {
-        options.daemonGiven = true;
-      }));
+      'Run as a daemon. (' + options.daemon + ')');
   add('--no-daemon',
       'Inverted option of --daemon.',
       generateOptionHandler(function(newValue) {
         options.daemon = !newValue;
-        options.daemonGiven = true;
       }));
   add('--pid-file <pid-file>',
-      'Output PID to <pid-file>.',
-      generateOptionHandler(function() {
-        options.pidFileGiven = true;
-      }));
+      'Output PID to <pid-file>.');
   add('--environment <environment>',
-      'Use specified environment. (' + options.environment + ')',
-      generateOptionHandler(function() {
-        options.environmentGiven = true;
-      }));
+      'Use specified environment. (' + options.environment + ')');
   return exports;
 }
 exports.define = define;
-------------- next part --------------
HTML����������������������������...
下載 



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