From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: access to Rainbows! config from within the application Date: Thu, 2 Sep 2010 23:28:26 -0700 Message-ID: <20100903062826.GA28607@dcvr.yhbt.net> References: <72D036D6-8B60-4CC4-A311-C6F3F56424CA@slofith.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1283495320 8587 80.91.229.12 (3 Sep 2010 06:28:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Sep 2010 06:28:40 +0000 (UTC) Cc: russell muetzelfeldt To: Rainbows! list Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Fri Sep 03 08:28:39 2010 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: <72D036D6-8B60-4CC4-A311-C6F3F56424CA-wWwMKTv0ClVAfugRpC6u6w@public.gmane.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:126 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OrPlM-0004hI-VT for gclrrg-rainbows-talk@m.gmane.org; Fri, 03 Sep 2010 08:28:37 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 645F019782D9; Fri, 3 Sep 2010 02:28:36 -0400 (EDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 1AFF719782D9 for ; Fri, 3 Sep 2010 02:28:27 -0400 (EDT) Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id 3F5901F541; Fri, 3 Sep 2010 06:28:27 +0000 (UTC) russell muetzelfeldt 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