1 |
|
-module(mongoose_graphql_server_admin_query). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-ignore_xref([execute/4]). |
7 |
|
|
8 |
|
-include("../mongoose_graphql_types.hrl"). |
9 |
|
|
10 |
|
execute(_Ctx, server, <<"status">>, _) -> |
11 |
2 |
{ok, {Status, Message, Version, CommitHash}} = mongoose_server_api:status(), |
12 |
2 |
{ok, #{<<"statusCode">> => status_code(Status), <<"message">> => Message, |
13 |
|
<<"version">> => Version, <<"commitHash">> => CommitHash}}; |
14 |
|
execute(_Ctx, server, <<"getLoglevel">>, _) -> |
15 |
20 |
mongoose_server_api:get_loglevel(); |
16 |
|
execute(_Ctx, server, <<"getCookie">>, _) -> |
17 |
2 |
mongoose_server_api:get_cookie(). |
18 |
|
|
19 |
2 |
status_code(true) -> <<"RUNNING">>; |
20 |
:-( |
status_code(false) -> <<"NOT_RUNNING">>. |