[Groonga-commit] droonga/droonga-engine at fa235d3 [master] droonga-engine: expand paths in configuration file

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jan 5 13:34:06 JST 2015


Kouhei Sutou	2015-01-05 13:34:06 +0900 (Mon, 05 Jan 2015)

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

  Message:
    droonga-engine: expand paths in configuration file
    
    Paths in configuration file are expanded as relative path from
    directory that has configuration file.

  Modified files:
    lib/droonga/command/droonga_engine.rb

  Modified: lib/droonga/command/droonga_engine.rb (+14 -4)
===================================================================
--- lib/droonga/command/droonga_engine.rb    2015-01-05 13:33:00 +0900 (81bd307)
+++ lib/droonga/command/droonga_engine.rb    2015-01-05 13:34:06 +0900 (619a620)
@@ -231,11 +231,21 @@ module Droonga
 
         def load_config
           config_path = Path.config
-          if config_path.exist?
-            YAML.load_file(config_path)
-          else
-            {}
+          return {} unless config_path.exist?
+
+          config = YAML.load_file(config_path)
+          path_keys = ["log_file", "pid_file"]
+          path_keys.each do |path_key|
+            path = config[path_key]
+            next if path.nil?
+
+            path = Pathname.new(path)
+            unless path.absolute?
+              path = (config_path.dirname + path).expand_path
+            end
+            config[path_key] = path
           end
+          config
         end
 
         def add_connection_options(parser)
-------------- next part --------------
HTML����������������������������...
Download 



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