diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/mongrel_rails | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails index 23121d8..74d56be 100644 --- a/bin/mongrel_rails +++ b/bin/mongrel_rails @@ -22,6 +22,7 @@ class Start < GemPlugin::Plugin "/commands" ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd], ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, "public"], ['-B', '--debug', "Enable debugging mode", :@debug, false], + ['-C', '--config PATH', "Use a config file", :@config_file, nil] ] end @@ -36,18 +37,24 @@ class Start < GemPlugin::Plugin "/commands" valid_dir? File.dirname(@pid_file), "Path to pid file not valid: #@pid_file" valid_dir? @docroot, "Path to docroot not valid: #@docroot" valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map - + valid_exists? @config_file, "Config file not there: #@config_file" if @config_file return @valid end def run + # command line setting override config file settings settings = { :host => @address, :port => @port, :cwd => @cwd, :log_file => @log_file, :pid_file => @pid_file, :environment => @environment, :docroot => @docroot, :mime_map => @mime_map, :daemon => @daemon, :debug => @debug, :includes => ["mongrel"] } + if @config_file + STDERR.puts "** Loading settings from #{@config_file} (command line options override)." + conf = YAML.load_file(@config_file) + settings = conf.merge(settings) + end config = Mongrel::Rails::RailsConfigurator.new(settings) do log "Starting Mongrel in #{settings[:environment]} mode at #{settings[:host]}:#{settings[:port]}" |