incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Somov (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message
Date Mon, 03 Oct 2011 08:10:34 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119188#comment-13119188
] 

Andrey Somov commented on COUCHDB-1285:
---------------------------------------

>how to register these modules ? 
I did not quite catch you. As far as I understand this is a pure configuration change, which
is going to be exposed only via the welcome message.
                
> 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

        

Mime
View raw message