[Groonga-commit] droonga/droonga-engine at 9446d3c [master] sample cluster: use config file instead of command line

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Mon Jan 5 13:38:50 JST 2015


Kouhei Sutou	2015-01-05 13:38:50 +0900 (Mon, 05 Jan 2015)

  New Revision: 9446d3cf3be227dc24c694209d5fdecad5ceff5f
  https://github.com/droonga/droonga-engine/commit/9446d3cf3be227dc24c694209d5fdecad5ceff5f

  Message:
    sample cluster: use config file instead of command line

  Modified files:
    sample/cluster/Rakefile

  Modified: sample/cluster/Rakefile (+18 -6)
===================================================================
--- sample/cluster/Rakefile    2015-01-05 13:37:28 +0900 (c573296)
+++ sample/cluster/Rakefile    2015-01-05 13:38:50 +0900 (76f73e8)
@@ -17,6 +17,7 @@
 
 require "pathname"
 require "json"
+require "yaml"
 
 base_dir_path = Pathname.new(__FILE__).dirname
 top_dir_path = base_dir_path.parent.parent
@@ -48,14 +49,12 @@ class DroongaEngine
     rm_rf(working_dir_path.to_s)
     mkdir_p(working_dir_path.to_s)
     generate_catalog(node_ids)
+    generate_config
   end
 
   def start
     @pid = spawn("droonga-engine",
-                 "--base-dir", working_dir_path.to_s,
-                 "--host", host,
-                 "--port", self.class.port.to_s,
-                 "--pid-file", pid_file_path.to_s)
+                 "--base-dir", working_dir_path.to_s)
   end
 
   def stop
@@ -77,8 +76,8 @@ class DroongaEngine
     working_dir_path + "catalog.json"
   end
 
-  def pid_file_path
-    working_dir_path + "droonga-engine.pid"
+  def config_path
+    working_dir_path + "droonga-engine.yaml"
   end
 
   def generate_catalog(node_ids)
@@ -91,6 +90,19 @@ class DroongaEngine
        "--hosts", hosts.join(","),
        "--port", self.class.port.to_s)
   end
+
+  def generate_config
+    config = {
+      "host"      => host,
+      "port"      => self.class.port,
+      "log_file"  => "droonga-engine.log",
+      "log_level" => "info",
+      "pid_file"  => "droonga-engine.pid",
+    }
+    config_path.open("w") do |file|
+      file.puts(config.to_yaml)
+    end
+  end
 end
 
 namespace :droonga do
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る