From dev-return-18346-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Mon Oct 3 13:28:58 2011 Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4854A99A6 for ; Mon, 3 Oct 2011 13:28:58 +0000 (UTC) Received: (qmail 35419 invoked by uid 500); 3 Oct 2011 13:28:57 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 35358 invoked by uid 500); 3 Oct 2011 13:28:57 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 35223 invoked by uid 99); 3 Oct 2011 13:28:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Oct 2011 13:28:57 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Oct 2011 13:28:55 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 526642A605E for ; Mon, 3 Oct 2011 13:28:35 +0000 (UTC) Date: Mon, 3 Oct 2011 13:28:35 +0000 (UTC) From: "Benjamin Young (Commented) (JIRA)" To: dev@couchdb.apache.org Message-ID: <745133967.3016.1317648515339.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <672355240.31521.1316106489039.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119300#comment-13119300 ] Benjamin Young commented on COUCHDB-1285: ----------------------------------------- @benoit what's the motivation behind a plural "vendors" object/array vs. a "vendor" key? There's really only ever one originating vendor. There are, of course, a chain of people responsible for the "shipped" product (which might be a combination of BigCouch + Refuge + GeoCouch), but the party responsible for distributing the app would be the single vendor recorded in the .ini they include with the download. Additionally, we need to avoid vendor names as keys in the vendor object. Doing so makes referencing the name of the product much more consistent (doc.vendor.name), avoids product names being entered again in Futon code, and allows vendors to use whatever sort of string name they like without developers having to do anything cumbersome or strange looking to reference the vendor's key. My goal is to make this generic and reusable by all the groups out there who would find value in this [vendor] section being added to the config. > Allow configuration of vendor and module version in the welcome message > ----------------------------------------------------------------------- > > Key: COUCHDB-1285 > URL: https://issues.apache.org/jira/browse/COUCHDB-1285 > Project: CouchDB > Issue Type: Improvement > Reporter: Jan Lehnardt > Attachments: vendor_and_modules_objects.patch > > > The patch below allows to configure vendor and module version information into the GET / welcome message. > E.g. > [vendor] > name = refuge > version = 2.0.0 > > [modules] > geocouch = 1.2.1 > would produce: > {"couchdb":"Welcome","version":"1.2.0","refuge":"2.0.0","modules":{"geocouch":"1.2.1"}} > -- > --- a/src/couchdb/couch_httpd_misc_handlers.erl > +++ b/src/couchdb/couch_httpd_misc_handlers.erl > @@ -30,9 +30,23 @@ > % httpd global handlers > > handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) -> > + Vendor = case couch_config:get("vendor") of > + [] -> []; > + Vendor1 -> [{ > + proplists:get_value("name", Vendor1), > + ?l2b(proplists:get_value("version", Vendor1)) > + }] > + end, > + > + Modules = lists:map(fun({Key, Value}) -> > + {Key, ?l2b(Value)} > + end, couch_config:get("modules")), > + > send_json(Req, {[ > {couchdb, WelcomeMessage}, > - {version, list_to_binary(couch_server:get_version())} > + {version, list_to_binary(couch_server:get_version())}] > + ++ Vendor > + ++ [{modules, {Modules}} > ]}); > handle_welcome_req(Req, _) -> > send_method_not_allowed(Req, "GET,HEAD"). > -- -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira