Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: russell muetzelfeldt <russm-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org>
To: Rainbows! list <rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org>
Subject: Re: access to Rainbows! config from within the application
Date: Fri, 3 Sep 2010 16:55:50 +1000	[thread overview]
Message-ID: <2E490C28-2499-482B-8897-CC93DC3F3802@slofith.org> (raw)
In-Reply-To: <20100903062826.GA28607-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>

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


      parent reply	other threads:[~2010-09-03  6:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  2:26 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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2E490C28-2499-482B-8897-CC93DC3F3802@slofith.org \
    --to=russm-wwwmktv0clvafugrpc6u6w@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this inbox:

	../../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).