Domanda

I'm using the puma application server, and it has a config file at config/puma.rb:

path = "/home/starkers/Documents/" + Rails.application.class.parent_name + "/tmp/puma/"

threads 0,20

environment "production"


daemonize true
bind  "unix://" + path + "socket/puma.sock"
pidfile path + "pid/puma.pid"
state_path path + "pid/puma.state"

When running puma -C config/puma.rb to load this file and start the application server, everything works apart from the Rails.application.class.parent_name.

Can you think of anyway to get constants into the puma.rb file? Failing this, I suppose a workaround whcih gets the directory name of the root would work.

I'd like to use this attribute as well in the config, Rails.root, but I need to get the Rails constant in! Do I need to use require?

È stato utile?

Soluzione

You're going to need to load up your entire Rails app to get access to that object. You should be able to do this with a require 'config/environment' at the top of your puma.rb.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top