bin/mongrel_rails in mongrel-0.3.12 vs bin/mongrel_rails in mongrel-0.3.12.1
- old
+ new
@@ -20,11 +20,12 @@
['-t', '--timeout SECONDS', "Timeout all requests after SECONDS time", :@timeout, 0],
['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
['-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]
+ ['-C', '--config PATH', "Use a config file", :@config_file, nil],
+ ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil]
]
end
def validate
@cwd = File.expand_path(@cwd)
@@ -45,44 +46,49 @@
# 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"]
+ :debug => @debug, :includes => ["mongrel"], :config_script => @config_script
}
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]}"
+ log "Starting Mongrel in #{defaults[:environment]} mode at #{defaults[:host]}:#{defaults[:port]}"
if defaults[:daemon]
- log "Daemonizing, any open files are closed. Look at #{settings[:pid_file]} and #{settings[:log_file]} for info."
+ log "Daemonizing, any open files are closed. Look at #{defaults[:pid_file]} and #{defaults[:log_file]} for info."
daemonize
end
listener do
mime = {}
if defaults[:mime_map]
- log "Loading additional MIME types from #{settings[:mime_map]}"
+ log "Loading additional MIME types from #{defaults[:mime_map]}"
mime = load_mime_map(defaults[:mime_map], mime)
end
if defaults[:debug]
log "Installing debugging prefixed filters. Look in log/mongrel_debug for the files."
debug "/"
end
- log "Starting Rails in environment #{settings[:environment]} ..."
+ log "Starting Rails in environment #{defaults[:environment]} ..."
uri "/", :handler => rails
log "Rails loaded."
log "Loading any Rails specific GemPlugins"
load_plugins
+
+ if defaults[:config_script]
+ log "Loading #{defaults[:config_script]} external config script"
+ run_config(defaults[:config_script])
+ end
setup_rails_signals
end
end