Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1285

Allow configuration of vendor and module version in the welcome message

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3
    • None
    • None

    Description

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

      Attachments

        1. vendor_and_modules_objects.patch
          0.9 kB
          Benjamin Young
        2. vendor_and_modules.patch
          4 kB
          Randall Leeds
        3. vendor_only.patch
          2 kB
          Randall Leeds

        Activity

          People

            tilgovi Randall Leeds
            jan Jan Lehnardt
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: