[Groonga-commit] droonga/droonga-http-server at 50ef3a5 [master] Add --environment option

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jul 13 15:08:31 JST 2014


Kouhei Sutou	2014-07-13 15:08:31 +0900 (Sun, 13 Jul 2014)

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

  Message:
    Add --environment option
    
    It can overwrite NODE_ENV environment variable value.

  Modified files:
    bin/droonga-http-server

  Modified: bin/droonga-http-server (+5 -2)
===================================================================
--- bin/droonga-http-server    2014-07-04 20:11:44 +0900 (2504c8a)
+++ bin/droonga-http-server    2014-07-13 15:08:31 +0900 (8a3de7f)
@@ -26,6 +26,8 @@ pluginsOption = function(newValue, oldValue) {
   });
 }
 
+options.environment = process.env.NODE_ENV || 'development';
+
 options
   .version(version)
   .option('--port <port>', 'Port number', intOption, 10041)
@@ -61,6 +63,8 @@ options
           ])
   .option('--daemon', 'Run as a daemon.')
   .option('--pid-file <pid-file>', 'Output PID to <pid-file>.')
+  .option('--environment <environment>',
+          'Use specified environment. (' + options.environment + ')')
   .parse(process.argv);
 
 if (options.daemon) {
@@ -96,8 +100,7 @@ var application = express();
 var server = http.createServer(application);
 
 application.set('json spaces', 1);
-var env = process.env.NODE_ENV || 'development';
-if (env == 'production') {
+if (options.environment == 'production') {
   application.set('json spaces', -1); // disable pretty print!
 }
 
-------------- next part --------------
HTML����������������������������...
Download 



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