search

Home  >  Q&A  >  body text

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中文网2775 days ago610

reply all(0)I'll reply

No reply
  • Cancelreply