diff --git a/include/maxscale/config.h b/include/maxscale/config.h index b6f3b38f8..e82cb518b 100644 --- a/include/maxscale/config.h +++ b/include/maxscale/config.h @@ -23,6 +23,7 @@ #include #include +#include MXS_BEGIN_DECLS @@ -395,4 +396,12 @@ void config_disable_feedback_task(void); */ bool config_reload(void); +/** + * @brief List all path parameters as JSON + * + * @param host Hostname of this server + * @return JSON object representing the paths used by MaxScale + */ +json_t* config_paths_to_json(const char* host); + MXS_END_DECLS diff --git a/server/core/config.cc b/server/core/config.cc index b8c8f47c1..43364ce43 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -3796,3 +3796,23 @@ int config_parse_server_list(const char *servers, char ***output_array) } return output_ind; } + +json_t* config_paths_to_json(const char* host) +{ + json_t* obj = json_object(); + + json_object_set_new(obj, "libdir", json_string(get_libdir())); + json_object_set_new(obj, "datadir", json_string(get_datadir())); + json_object_set_new(obj, "process_datadir", json_string(get_process_datadir())); + json_object_set_new(obj, "cachedir", json_string(get_cachedir())); + json_object_set_new(obj, "configdir", json_string(get_configdir())); + json_object_set_new(obj, "config_persistdir", json_string(get_config_persistdir())); + json_object_set_new(obj, "module_configdir", json_string(get_module_configdir())); + json_object_set_new(obj, "piddir", json_string(get_piddir())); + json_object_set_new(obj, "logdir", json_string(get_logdir())); + json_object_set_new(obj, "langdir", json_string(get_langdir())); + json_object_set_new(obj, "execdir", json_string(get_execdir())); + json_object_set_new(obj, "connector_plugindir", json_string(get_connector_plugindir())); + + return obj; +} diff --git a/server/core/resource.cc b/server/core/resource.cc index 3ab520b96..5a774793d 100644 --- a/server/core/resource.cc +++ b/server/core/resource.cc @@ -306,8 +306,7 @@ HttpResponse cb_get_session(const HttpRequest& request) HttpResponse cb_maxscale(const HttpRequest& request) { - // TODO: Show logs - return HttpResponse(MHD_HTTP_OK); + return HttpResponse(MHD_HTTP_OK, config_paths_to_json(request.host())); } HttpResponse cb_logs(const HttpRequest& request)