[Groonga-commit] groonga/gcs [master] Take gcs configs from environment variables #105

Back to archive index

Yoji SHIDARA null+****@clear*****
Thu Oct 4 17:50:52 JST 2012


Yoji SHIDARA	2012-10-04 17:50:52 +0900 (Thu, 04 Oct 2012)

  New Revision: 175e40d2f2a5bfd1d63bd380254537819e69ab26
  https://github.com/groonga/gcs/commit/175e40d2f2a5bfd1d63bd380254537819e69ab26

  Log:
    Take gcs configs from environment variables #105

  Modified files:
    bin/gcs
    lib/command-line.js

  Modified: bin/gcs (+4 -1)
===================================================================
--- bin/gcs    2012-10-04 14:30:01 +0900 (c9a0377)
+++ bin/gcs    2012-10-04 17:50:52 +0900 (b941dd9)
@@ -6,20 +6,23 @@ var commandLine = new CLI();
 
 commandLine
   .option('-p, --port <port>',
-          'specify port [' + CLI.defaultPort + ']',
+          'specify port (GCS_PORT) [' + CLI.defaultPort + ']',
           Number,
           CLI.defaultPort)
   .option('--privilege <ip range>',
           'list of IP ranges for privileged client '+
+          '(GCS_PRIVILEGED_RANGES) '+
             '[' + CLI.defaultPrivilegedRanges + ']',
           String,
           CLI.defaultPrivilegedRanges)
   .option('--base-host <hostname>',
           'The base host name assigned to the service '+
+          '(GCS_BASE_HOST) '+
             '[' + CLI.defaultBaseHost + ']',
           String)
   .option('--configuration-host <hostname>',
           'The host name for configuration API of the service '+
+          '(GCS_CONFIGURATION_HOST) '+
             '[' + CLI.defaultConfigurationHost + ']',
           String)
   .parse();

  Modified: lib/command-line.js (+9 -6)
===================================================================
--- lib/command-line.js    2012-10-04 14:30:01 +0900 (367a7ce)
+++ lib/command-line.js    2012-10-04 17:50:52 +0900 (e0604f6)
@@ -6,19 +6,22 @@ var path = require('path');
 
 var defaultDatabasePath =
       exports.defaultDatabasePath =
-      CommandLineInterface.defaultDatabasePath = process.env.HOME + '/.gcs/database/gcs';
+      CommandLineInterface.defaultDatabasePath = process.env.GCS_DATABASE_PATH || process.env.HOME + '/.gcs/database/gcs';
 var defaultPort =
       exports.defaultPort =
-      CommandLineInterface.defaultPort = 7575;
+      CommandLineInterface.defaultPort = process.env.GCS_PORT || 7575;
 var defaultBaseHost =
       exports.defaultBaseHost =
-      CommandLineInterface.defaultBaseHost = '127.0.0.1.xip.io:' + defaultPort;
+      CommandLineInterface.defaultBaseHost =
+        process.env.GCS_BASE_HOST || '127.0.0.1.xip.io:' + defaultPort;
 var defaultConfigurationHost =
       exports.defaultConfigurationHost =
-      CommandLineInterface.defaultConfigurationHost = '127.0.0.1.xip.io:' + defaultPort;
+      CommandLineInterface.defaultConfigurationHost =
+        process.env.GCS_CONFIGURATION_HOST || '127.0.0.1.xip.io:' + defaultPort;
 var defaultPrivilegedRanges =
       exports.defaultPrivilegedRanges =
-      CommandLineInterface.defaultPrivilegedRanges = '127.0.0.0/8';
+      CommandLineInterface.defaultPrivilegedRanges =
+        process.env.GCS_PRIVILEGED_RANGES || '127.0.0.0/8';
 
 function CommandLineInterface() {
   this.program = program;
@@ -55,7 +58,7 @@ CommandLineInterface.prototype = {
 
     this.program
       .option('--database-path <path>',
-              'database path [' + defaultDatabasePath + ']',
+              'database path (GCS_DATABASE_PATH) [' + defaultDatabasePath + ']',
               String,
               defaultDatabasePath);
 
-------------- next part --------------
HTML����������������������������...
Download 



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