Heim > Fragen und Antworten > Hauptteil
比如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
却不能达到目的,有没有可行方法?