1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Add ability to autoload a config file. Fixes #438

This commit is contained in:
Evan Phoenix 2014-01-25 14:18:03 -08:00
parent ff0d3b553d
commit 7d7a1fbebe

View file

@ -267,6 +267,27 @@ module Puma
end
end
def find_config
if cfg = @options[:config_file]
# Allow - to disable config finding
if cfg == "-"
@options[:config_file] = nil
return
end
return
end
pos = []
if env = (@options[:environment] || ENV['RACK_ENV'])
pos << "config/puma/#{env}.rb"
end
pos << "config/puma.rb"
@options[:config_file] = pos.find { |f| File.exists? f }
end
# :nodoc:
def parse_options
@parser.parse! @argv
@ -275,6 +296,8 @@ module Puma
@options[:rackup] = @argv.shift
end
find_config
@config = Puma::Configuration.new @options
# Advertise the Configuration