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:
parent
ff0d3b553d
commit
7d7a1fbebe
1 changed files with 23 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue