Last active
May 30, 2016 21:58
-
-
Save tacionery/da67278e93d933fb3154ee74a29f188e to your computer and use it in GitHub Desktop.
puma config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/puma.rb | |
threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 6) | |
workers Integer(ENV['WORKERS'] || 2) | |
port ENV['PORT'] || 3000 | |
environment ENV['RAILS_ENV'] || 'development' | |
preload_app! | |
on_worker_boot do | |
require "active_record" | |
cwd = File.dirname(__FILE__)+"/.." | |
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished | |
ActiveRecord::Base.establish_connection(ENV["DATABASE_URL"] || YAML.load_file("#{cwd}/config/database.yml")[ENV["RAILS_ENV"]]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment