开发者

rails / passenger: using environment variable for memcache server address

I am trying to set up our Rails app to pull the address of the memcache server from an environment variable (we have 2 'production' environments, one for testing and one for live, and hence can't have different environments files).

This is a Rails 2.3.11 app, not rails 3.

I have this in my envi开发者_如何学运维ronments/production.rb file:

config.cache_store = :mem_cache_store, ENV['MEMCACHE_SERVERS'] || 'localhost:11211'

If I fire up a Rails console and do:

Rails.cache.stats

I see that it is using the right one out of the environment variable (set in /etc/environments on our ubuntu servers).

But, if our actual running rails app fired up via passenger it is using localhost!

Does Passenger not use the environment or am I doing something else wrong?

If there is a better way of doing this of course I am open to suggestions!


Have you tried using the Apache directive SetEnv or the equivalent for your server? The environment is heavily modified for Apache sub-processes, of which Passenger is one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜