Skip to content

Commit

Permalink
feat: add spidermonkey and erlang version to welcome message, closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
janl committed Apr 6, 2021
1 parent ca86ae1 commit 809fc53
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions rebar.config.script
Expand Up @@ -27,7 +27,6 @@ end.
VerList = lists:map(fun(X) -> {Int, _} = string:to_integer(X), Int end,
string:tokens(VerString, ".")).


DisplayMsg = fun(Msg, Args) ->
Base = iolist_to_binary(io_lib:format(Msg, Args)),
Lines = binary:split(Base, <<"\n">>, [global]),
Expand Down Expand Up @@ -200,7 +199,7 @@ AddConfig = [
{deps, lists:map(MakeDep, DepDescs ++ OptionalDeps)},
{sub_dirs, SubDirs},
{lib_dirs, ["src"]},
{erl_opts, [{i, "../"}] ++ ErlOpts},
{erl_opts, [{i, "../"}] ++ [{d, 'COUCHDB_ERLANG_VERSION', VerString}] ++ ErlOpts},
{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]},
{plugins, [eunit_plugin]},
{dialyzer, [
Expand Down
5 changes: 5 additions & 0 deletions src/chttpd/src/chttpd_misc.erl
Expand Up @@ -47,6 +47,11 @@ handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) ->
{couchdb, WelcomeMessage},
{version, list_to_binary(couch_server:get_version())},
{git_sha, list_to_binary(couch_server:get_git_sha())},
{erlang_verison, ?l2b(?COUCHDB_ERLANG_VERSION)},
{javascript_engine, {[
{name, <<"spidermonkey">>},
{version, couch_server:get_spidermonkey_version()}
]}},
{uuid, couch_server:get_uuid()},
{features, get_features()}
] ++ case config:get("vendor") of
Expand Down
1 change: 1 addition & 0 deletions src/couch/rebar.config.script
Expand Up @@ -215,6 +215,7 @@ AddConfig = [
{erl_opts, PlatformDefines ++ [
{d, 'COUCHDB_VERSION', Version},
{d, 'COUCHDB_GIT_SHA', GitSha},
{d, 'COUCHDB_SPIDERMONKEY_VERSION', SMVsn},
{i, "../"}
] ++ MD5Config ++ ProperConfig},
{port_env, PortEnvOverrides},
Expand Down
4 changes: 3 additions & 1 deletion src/couch/src/couch_server.erl
Expand Up @@ -28,7 +28,7 @@
-export([lock/2, unlock/1]).
-export([db_updated/1]).
-export([num_servers/0, couch_server/1, couch_dbs_pid_to_name/1, couch_dbs/1]).
-export([aggregate_queue_len/0]).
-export([aggregate_queue_len/0,get_spidermonkey_version/0]).

% config_listener api
-export([handle_config_change/5, handle_config_terminate/3]).
Expand Down Expand Up @@ -84,6 +84,8 @@ get_stats() ->
lists:foldl(Fun, {0, 0}, lists:seq(1, num_servers())),
[{start_time, ?l2b(Time)}, {dbs_open, Open}].

get_spidermonkey_version() -> list_to_binary(?COUCHDB_SPIDERMONKEY_VERSION).

sup_start_link(N) ->
gen_server:start_link({local, couch_server(N)}, couch_server, [N], []).

Expand Down

0 comments on commit 809fc53

Please sign in to comment.