Heim  >  Fragen und Antworten  >  Hauptteil

ruby - unicorn的配置如何按环境分开多个pid?

比如unicorn的配置文件(config/unicorn.rb)中默认这样写:

listen "/tmp/myapp/unicorn.sock", backlog: 1
pid "/tmp/myapp/unicorn.pid"

要根据实际运行环境和测试环境区分开,想这样实现:

if ENV["RAILS_ENV"] == "production"
  listen "/tmp/myapp/unicorn.sock", backlog: 1
  pid "/tmp/myapp/unicorn.pid"
else
  listen "/tmp/myapp/test.sock", backlog: 1
  pid "/tmp/myapp/test.pid"
end

却不能达到目的,有没有可行方法?

PHP中文网PHP中文网2762 Tage vor598

Antworte allen(0)Ich werde antworten

Keine Antwort
  • StornierenAntwort