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_LOCATIONhttp://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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/3/08, phil <phil-o0Q4Q1ys/oVBDgjK7y7TUQ@public.gmane.org> 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/webApiXmlRpcServletI assume you probably are but are you actually exporting it? export XML_API> 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.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 Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yes, putting it on the command line works... How can starting mongrel as my user have a different environment than starting the console? On Jan 3, 5:49 pm, "Greg Donald" <gdon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1/3/08, phil <p...-o0Q4Q1ys/oVBDgjK7y7TUQ@public.gmane.org> wrote: > > > > > I am trying to do something that I thought would be trivial - pulling > > in a value from anenvironmentvariable. > > 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 > > > > > It shows up in the output of typing ''env'' at the command prompt. > > In myenvironment.rb I have this: > > XML_RPC_LOCATION = ENV[''XML_API''] || ''http://xxxx/abp3/ > > webApiXmlRpcServlet'' > > > From console I get: > > Loading productionenvironment. > > >> 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 productionenvironment(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 sameenvironmentvariables. You can putenvironmentvariables > on the command line to check if that''s the actual problem. > > XML_API=http://192.168.1.5:8080/abp3/webApiXmlRpcServletmongrel_rails start > > Or such. > > -- > Greg Donaldhttp://destiney.com/--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---