MXS-1220: Implement /maxscale/ resource
The resource exposes the various directories that MaxScale uses. Further information, like uptime, could be added at a later point.
This commit is contained in:
@ -23,6 +23,7 @@
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#include <maxscale/modinfo.h>
|
#include <maxscale/modinfo.h>
|
||||||
|
#include <maxscale/jansson.h>
|
||||||
|
|
||||||
MXS_BEGIN_DECLS
|
MXS_BEGIN_DECLS
|
||||||
|
|
||||||
@ -395,4 +396,12 @@ void config_disable_feedback_task(void);
|
|||||||
*/
|
*/
|
||||||
bool config_reload(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
|
MXS_END_DECLS
|
||||||
|
@ -3796,3 +3796,23 @@ int config_parse_server_list(const char *servers, char ***output_array)
|
|||||||
}
|
}
|
||||||
return output_ind;
|
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;
|
||||||
|
}
|
||||||
|
@ -306,8 +306,7 @@ HttpResponse cb_get_session(const HttpRequest& request)
|
|||||||
|
|
||||||
HttpResponse cb_maxscale(const HttpRequest& request)
|
HttpResponse cb_maxscale(const HttpRequest& request)
|
||||||
{
|
{
|
||||||
// TODO: Show logs
|
return HttpResponse(MHD_HTTP_OK, config_paths_to_json(request.host()));
|
||||||
return HttpResponse(MHD_HTTP_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse cb_logs(const HttpRequest& request)
|
HttpResponse cb_logs(const HttpRequest& request)
|
||||||
|
Reference in New Issue
Block a user