* access to Rainbows! config from within the application
@ 2010-09-03 2:26 russell muetzelfeldt
[not found] ` <72D036D6-8B60-4CC4-A311-C6F3F56424CA-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: russell muetzelfeldt @ 2010-09-03 2:26 UTC (permalink / raw)
To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw
Hi All,
Is there any way to read the server configuration from within the application that's being hosted?
I'm about to add a Rainbows!-hosted file upload component to an existing application. At the moment I've got duplication between the app ("Note: maximum attachment size is 200MB") and rainbows.rb ("client_max_body_size 200*1024*1024") and am wondering if there's any way for the app to know what client_max_body_size the server is configured for so I can display a human-friendly version of that on the attachment page.
(please cc: replies as I'm not subscribed to the list)
cheers
Russell
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: access to Rainbows! config from within the application
[not found] ` <72D036D6-8B60-4CC4-A311-C6F3F56424CA-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org>
@ 2010-09-03 6:28 ` Eric Wong
[not found] ` <20100903062826.GA28607-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2010-09-03 6:28 UTC (permalink / raw)
To: Rainbows! list; +Cc: russell muetzelfeldt
russell muetzelfeldt <russm-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org> wrote:
> Hi All,
>
> Is there any way to read the server configuration from within the
> application that's being hosted?
Hi russell,
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. Sometimes it's not easy to avoid (e.g.
async.callback + EventMachine stuff), but we try.
However, since the config file is Ruby, you can always use a global
variable in your config file.
> I'm about to add a Rainbows!-hosted file upload component to an
> existing application. At the moment I've got duplication between the
> app ("Note: maximum attachment size is 200MB") and rainbows.rb
> ("client_max_body_size 200*1024*1024") and am wondering if there's any
> way for the app to know what client_max_body_size the server is
> configured for so I can display a human-friendly version of that on
> the attachment page.
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.
> (please cc: replies as I'm not subscribed to the list)
--
Eric Wong
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: access to Rainbows! config from within the application
[not found] ` <20100903062826.GA28607-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
@ 2010-09-03 6:55 ` russell muetzelfeldt
0 siblings, 0 replies; 3+ messages in thread
From: russell muetzelfeldt @ 2010-09-03 6:55 UTC (permalink / raw)
To: Rainbows! list
On 03/09/2010, at 4:28 PM, Eric Wong wrote:
> russell muetzelfeldt <russm-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org> 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
end
and then referencing MAX_UPLOAD in my config.ru 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!
cheers
Russell
>> (please cc: replies as I'm not subscribed to the list)
(now subscribed)
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-03 6:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-03 2:26 access to Rainbows! config from within the application russell muetzelfeldt
[not found] ` <72D036D6-8B60-4CC4-A311-C6F3F56424CA-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org>
2010-09-03 6:28 ` Eric Wong
[not found] ` <20100903062826.GA28607-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2010-09-03 6:55 ` russell muetzelfeldt
Code repositories for project(s) associated with this public inbox
https://yhbt.net/rainbows.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).