access to Rainbows! config from within the application

russell muetzelfeldt russm at
Fri Sep 3 02:55:50 EDT 2010

On 03/09/2010, at 4:28 PM, Eric Wong wrote:
> russell muetzelfeldt <russm at> wrote:
>> Is there any way to read the server configuration from within the
>> application that's being hosted?
> There's no stable/official internal API, and there probably won't be.
> We try not to encourage propagating new, ad-hoc standards that other
> Rack servers do not support.

absolutely fair enough...

> So something like this:
>  Rainbows! do
>    client_max_body_size($client_max_body_size = 200*1024*1024)
>  end
> If you have more variables you want to set, I know some folks
> that use a global hash object or Struct, too.

ah, OK. I wasn't sure what context the Rainbows! config was evaluated in and tried

MAX_UPLOAD = 200*1024*1024
Rainbows! do
  client_max_body_size MAX_UPLOAD

and then referencing MAX_UPLOAD in my where app-wide stuff gets stuffed into Rack::Config but couldn't resolve that constant - rather than wading into looking at the scopes used for config evaluation I thought I'd just ask...

rather than using global vars I've packed some constants into a Config module in my app and it's all good.

thanks for the pointer!



>> (please cc: replies as I'm not subscribed to the list)

(now subscribed)

More information about the rainbows-talk mailing list