18 lines
593 B
C
18 lines
593 B
C
#include "ConfigManager.h"
|
|
#include "settings_file.h"
|
|
#include "config.h"
|
|
#include <file.h>
|
|
|
|
void get_settings_file(struct mg_connection *c, struct mg_http_message *hm) {
|
|
char *filename = cm_get_parameter_as_string(config, "dnsmasq_config");
|
|
if (!filename) {
|
|
mg_http_reply(c, 500, HTTP_HEADERS, "{%m:%m}", MG_ESC("error"),
|
|
MG_ESC("can't read config file"));
|
|
return;
|
|
}
|
|
char *data = read_file(filename);
|
|
mg_http_reply(c, 200, "Content-Type: text/plain\r\nAccess-Control-Allow-Origin: *\r\n", data);
|
|
free(data);
|
|
free(filename);
|
|
}
|