Navigation Menu

Skip to content

Commit

Permalink
droonga-engine: expand paths in configuration file
Browse files Browse the repository at this point in the history
Paths in configuration file are expanded as relative path from
directory that has configuration file.
  • Loading branch information
kou committed Jan 5, 2015
1 parent b0ec195 commit fa235d3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/droonga/command/droonga_engine.rb
Expand Up @@ -231,11 +231,21 @@ def config

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)
Expand Down

0 comments on commit fa235d3

Please sign in to comment.