Logger and config refactor

This commit is contained in:
2022-12-19 14:28:40 +01:00
parent 45514f90ca
commit dd4f768cc4
6 changed files with 14 additions and 12 deletions

View File

@ -14,7 +14,6 @@
#include <stdlib.h>
config_t config;
char geoip_dir[256], dns_server[256];
int config_load(const char *filename) {
FILE *file = fopen(filename, "r");
@ -77,10 +76,10 @@ int config_load(const char *filename) {
} else if (section == 0) {
if (len > 10 && strncmp(ptr, "geoip_dir", 9) == 0 && (ptr[9] == ' ' || ptr[9] == '\t')) {
source = ptr + 9;
target = geoip_dir;
target = config.geoip_dir;
} else if (len > 11 && strncmp(ptr, "dns_server", 10) == 0 && (ptr[10] == ' ' || ptr[10] == '\t')) {
source = ptr + 10;
target = dns_server;
target = config.dns_server;
} else {
goto err;
}

View File

@ -52,10 +52,11 @@ typedef struct {
typedef struct {
host_config_t hosts[CONFIG_MAX_HOST_CONFIG];
cert_config_t certs[CONFIG_MAX_CERT_CONFIG];
char geoip_dir[256];
char dns_server[256];
} config_t;
extern config_t config;
extern char geoip_dir[256], dns_server[256];
int config_load(const char *filename);

View File

@ -15,7 +15,7 @@
#define PROXY_COMPRESS 6
#ifndef SERVER_NAME
# define SERVER_NAME "revproxy"
# define SERVER_NAME "reverse proxy"
#endif
#include "http.h"