You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Jan Lehnardt (JIRA)" <ji...@apache.org> on 2011/09/15 19:08:09 UTC

[jira] [Created] (COUCHDB-1285) Allow configuration of vendor and module version in 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


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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benjamin Young (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Young updated COUCHDB-1285:
------------------------------------

    Attachment: vendor_and_modules_objects.patch

This patch makes Vendors and Modules JSON objects inside the "Welcome" JSON object returned from "/"

Vendors has been made an object to allow more consistent referencing of the vendor version number and other potential vendor specific information without the need to reference the vendor name in client-side code (namely, Futon).

The version number can now be retrieved at doc.vendor.version vs. doc.refuge (or similar).
                
> 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Andrey Somov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105954#comment-13105954 ] 

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

+1 for this patch. (it would be also useful to show this info in Futon)

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Andrey Somov (Commented) (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benjamin Young (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119768#comment-13119768 ] 

Benjamin Young commented on COUCHDB-1285:
-----------------------------------------

Should we consider splitting this ticket? One for vendor object stuff and one for modules?

This modules approach seems great as it's tied to more useful features than just version reporting, but it also greatly extends the meaning of this ticket's title. :)

Great work, Randall.
                
> 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.patch, 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benoit Chesneau (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119146#comment-13119146 ] 

Benoit Chesneau commented on COUCHDB-1285:
------------------------------------------

yes. that's better indeed. One thing though that isn't soved yet is how to register these modules ?
                
> 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

        

[jira] [Closed] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Randall Leeds (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Randall Leeds closed COUCHDB-1285.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3
         Assignee: Randall Leeds

Vendor information included on master and will land in 1.3. Will open another ticket with module patch.
                
> 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
>            Assignee: Randall Leeds
>             Fix For: 1.3
>
>         Attachments: vendor_and_modules.patch, vendor_and_modules_objects.patch, vendor_only.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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Andrey Somov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119328#comment-13119328 ] 

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

+1 to have just one vendor
                
> 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Andrey Somov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106084#comment-13106084 ] 

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

It can also be extended:
"vendor":{"name":"refuge", "version": "2.0.0", "url": "http://www.couchbase.com/", "logo_url" : "http://www.couchbase.com/img/logo.png"} 

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benjamin Young (Commented) (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benjamin Young (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106521#comment-13106521 ] 

Benjamin Young commented on COUCHDB-1285:
-----------------------------------------

Precisely. :)

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benoit Chesneau (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13118955#comment-13118955 ] 

Benoit Chesneau commented on COUCHDB-1285:
------------------------------------------

@benjamin though url & logos are wrong here ;) iit should be http://refuge.io . anyway I would suggest rather :


vendors: [ {"name": "somevendor", "version": ...}, ...] 

or

vendors: [{"vendorname": { "version": ...} ]


not sure what's the best. 

- benoit
                
> 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

       

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benjamin Young (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106070#comment-13106070 ] 

Benjamin Young commented on COUCHDB-1285:
-----------------------------------------

One suggested change to this patch. Rather than making the key in the welcome JSON the vendor's name, it should be changed to be a key named "vendor" with the full vendor info underneath as an object:
"vendor":{"name":"refuge", "version": "2.0.0"}

That way in Futon (and elsewhere) the vendor version can be retrieved by referencing info.vendor.version rather than info.refuge--which would unnecessarily "fork" Futon per vendor version).

Thanks.

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benjamin Young (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119856#comment-13119856 ] 

Benjamin Young commented on COUCHDB-1285:
-----------------------------------------

Thanks, Randall.

We should also probably consider having a "package" or similar key, so that the package names can easily show up in Futon--not just vendor names.

[vendor]
name = Cloudant
package = BigCouch
version = 1.3.22

Futon could then easily use vendor.name + vendor.package in the title bar of _utils for instance and down in the right-hand sidebar area.

Thoughts?
                
> 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.patch, vendor_and_modules_objects.patch, vendor_only.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

        

[jira] [Updated] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Randall Leeds (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Randall Leeds updated COUCHDB-1285:
-----------------------------------

    Attachment: vendor_and_modules.patch

I think just vendor (not plural) is sufficient and consistent with the way it makes sense to configure.

{"couchdb" : WelcomeMessage,
 "version" : ...,
 "vendor" : {couch_config:get("vendor")}
}

This patch impements the above, takes the "modules section" out of the welcome message, and uses the [modules] section as MFA tuples for secondary supervisors.

1) [modules] provides a place to OTP-ify secondary couch supervisors (I've already done this with couch_update_notifier_sup in this patch).

2) Modules are required to be supervise-able and authors of well-behaved modules can take care to unset any changes the module makes to couch_config if the module is stopped (automatically done if [modules] section is changed).

3) Modules have a start-up hook so that authors need not ship a .ini file if they would rather use couch_config from code at startup. Also, the start-up hook can initialize modules of any complexity and ensure proper supervision.

4) Values from acinclude.m4 are placed into the default.ini template for [vendor] so that it's possible to keep the autotools packaging and change acinclude.m4 to have custom vendor version.

5) Module installations are not automatically made known to clients. Some modules perhaps should not broadcast their presence and those that do should consider doing so at a well known endpoint rather than in the welcome message.

I would suggest establishing a convention for authors to provide their own welcome message/object under /_module/<name>. This path prefix can also provide modules with a place to attach any interface (user or application). This is only convention and no new code. Additionally, it provides a convention for querying for module presence.
                
> 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.patch, 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Paul Joseph Davis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13118908#comment-13118908 ] 

Paul Joseph Davis commented on COUCHDB-1285:
--------------------------------------------

+1 though do you need a ?l2b(Key) when grabbing stuff from the config? The values have it. I don't remember autoconverting keys from strings, but I could be mistaken.
                
> 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Benjamin Young (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105605#comment-13105605 ] 

Benjamin Young commented on COUCHDB-1285:
-----------------------------------------

+1 for this patch. It does a great job of incorporating current patterns [1] and opening the door to simple module tracking and version reporting. Great work, Jan.

[1] http://bigbluehat.cloudant.com/

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Randall Leeds (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119670#comment-13119670 ] 

Randall Leeds commented on COUCHDB-1285:
----------------------------------------

I also would welcome a version where the module initialization hook returns a child specification so that it may be a supervisor or a worker and support the 'dynamic' argument in the child specification.

Keep in mind that not every couchdb plugin/module needs to register anything under [modules]. Only if it needs to link into start/stop lifecycle hooks.
                
> 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.patch, 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

        

[jira] [Commented] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Randall Leeds (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13119074#comment-13119074 ] 

Randall Leeds commented on COUCHDB-1285:
----------------------------------------

Did you mean:
vendors: {"vendorname": { "version": ...}, ...} ?

vendors is an object of vendorname : attribute object rather than an array?
                
> 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

        

[jira] [Updated] (COUCHDB-1285) Allow configuration of vendor and module version in the welcome message

Posted by "Randall Leeds (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Randall Leeds updated COUCHDB-1285:
-----------------------------------

    Attachment: vendor_only.patch

Sure thing, Ben.

Here's a version of the patch that only does the vendor bits. I added back the handling of an empty [vendor] section like Jan had it, just in case.

Default setup shows
{"couchdb":"Welcome","version":"1.3.0a-0dd0168-git","vendor":{"version":"1.3.0a-0dd0168-git","name":"The Apache Software Foundation"}}

No objections I'll commit this tomorrow.
                
> 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.patch, vendor_and_modules_objects.patch, vendor_only.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