Environment variables problem

I am trying to do something that I thought would be trivial - pulling
in a value from an environment variable.
in my .bash_profile I have:
XML_API=http://192.168.1.5:8080/abp3/webApiXmlRpcServlet

It shows up in the output of typing ‘env’ at the command prompt.
In my environment.rb I have this:
XML_RPC_LOCATION = ENV[‘XML_API’] || ‘http://xxxx/abp3/
webApiXmlRpcServlet’

From console I get:
Loading production environment.

puts XML_RPC_LOCATION
http://192.168.1.5:8080/abp3/webApiXmlRpcServlet

Which is correct.

But from inside my rails app I get:
XML_RPC_LOCATION:
http://xxxx/abp3/webApiXmlRpcServlet

What is going on?

The same thing is happening on my production environment (RH linux)
and on my Mac. So I am sure it is me… I just can’t understand why
the console and the mongrel are different.

Thanks

On 1/3/08, phil [email protected] wrote:

I am trying to do something that I thought would be trivial - pulling
in a value from an environment variable.
in my .bash_profile I have:
XML_API=http://192.168.1.5:8080/abp3/webApiXmlRpcServlet

I assume you probably are but are you actually exporting it?

export XML_API

Which is correct.

But from inside my rails app I get:
XML_RPC_LOCATION:
http://xxxx/abp3/webApiXmlRpcServlet

What is going on?

The same thing is happening on my production environment (RH linux)
and on my Mac. So I am sure it is me… I just can’t understand why
the console and the mongrel are different.

It seems like the user you are running your app as doesn’t have access
to the same environment variables. You can put environment variables
on the command line to check if that’s the actual problem.

XML_API=http://192.168.1.5:8080/abp3/webApiXmlRpcServlet mongrel_rails
start

Or such.


Greg D.
http://destiney.com/

Yes, putting it on the command line works…
How can starting mongrel as my user have a different environment than
starting the console?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs