httpi icon indicating copy to clipboard operation
httpi copied to clipboard

How can we define the environment for mounted rails apps

Open AJFaraday opened this issue 5 years ago • 2 comments

Sorry if this is the wrong place to ask this, but I can't find any documentation about it.

I'm mounting an app with the HTTPI Rack adapter:

::HTTPI.adapter = :rack
::HTTPI::Adapter::Rack.mount 'app', ::MyApp::Application

However, it's starting up in development mode, which may be the root of a problem.

I've tried a few different approaches to set the environment before mounting

`export RAILS_ENV=production`
Rails.env = 'production'
Rails.env = 'PRODUCTION'

None of these seem to have worked so far.

AJFaraday avatar Mar 19 '20 11:03 AJFaraday

Hi @AJFaraday

The short answer is I don't know how to set the environment for your case. The only documentation this adapter has is the PR that implemented: https://github.com/savonrb/httpi/pull/75.

What's your root problem? What do you want to do with this? The idea of this adapter is using to test only I think.

Hope that helps.

rogerleite avatar Mar 19 '20 13:03 rogerleite

@rogerleite The issue is occurring in testing, when a value in one of the arguments contains a % symbol.

/home/biorails/.rvm/rubies/ruby-2.2.10/lib/ruby/2.2.0/uri/common.rb:382:in `decode_www_form_component': invalid %-encoding ("1.0" encoding="ISO-8859-1"?><en

It doesn't seem to be reaching the controller, the call doesn't hit the logs.

It's fine when I pass the exact XML to a production server there's no error.


The environment was the only difference I could see.

AJFaraday avatar Mar 19 '20 13:03 AJFaraday