Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: Rainbows! list <rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org>
Cc: russell muetzelfeldt <russm-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org>
Subject: Re: access to Rainbows! config from within the application
Date: Thu, 2 Sep 2010 23:28:26 -0700	[thread overview]
Message-ID: <20100903062826.GA28607@dcvr.yhbt.net> (raw)
In-Reply-To: <72D036D6-8B60-4CC4-A311-C6F3F56424CA-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org>

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)

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
Do not quote signatures (like this one) or top post when replying

  parent reply	other threads:[~2010-09-03  6:28 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 [this message]
     [not found]     ` <20100903062826.GA28607-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2010-09-03  6:55       ` russell muetzelfeldt

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:

  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=20100903062826.GA28607@dcvr.yhbt.net \
    --to=normalperson-rmlxzr9ms24@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    --cc=russm-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org \


* 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:


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