aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2025-11-10 23:50:02 +0100
committerarf20 <aruizfernandez05@gmail.com>2025-11-10 23:50:02 +0100
commit6bf70db630afa19d0407d6468df8de307bccfecd (patch)
tree6f33f87121d6b00424fb3bec4230e8ac9feefc8c /main.c
parent26aedc1555186b3be00cf719c2376585035b86af (diff)
downloadarfnet2-status-6bf70db630afa19d0407d6468df8de307bccfecd.tar.gz
arfnet2-status-6bf70db630afa19d0407d6468df8de307bccfecd.zip
fix config
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/main.c b/main.c
index 784c0e2..92ff700 100644
--- a/main.c
+++ b/main.c
@@ -17,9 +17,6 @@
#include "check.h"
#include "alert.h"
-#define CFG_FILE "monitor.cfg"
-#define TMPL_FILE "index.htm.tmpl"
-#define LOG_FILE "events.log"
static char *index_format_template = NULL;
@@ -76,8 +73,11 @@ enum MHD_Result answer_to_connection(
int main() {
printf("ARFNET Status Monitor (C) 2025 under GPLv3\n");
+ if (config_load(CONFIG_PATH) < 0)
+ return 1;
+
/* read index template file */
- FILE *tf = fopen(TMPL_FILE, "r");
+ FILE *tf = fopen(tmpl_path, "r");
if (!tf) {
fprintf(stderr, "error opening index template file: %s\n",
strerror(errno));
@@ -90,9 +90,6 @@ int main() {
fread(index_format_template, 1, tfs, tf);
fclose(tf);
- if (config_load(CONFIG_PATH) < 0)
- return 1;
-
if (check_init() < 0)
return 1;
@@ -115,10 +112,9 @@ int main() {
return 1;
}
-
while (1) {
check_perform(targets, targets_size);
- monitor_update_events(LOG_FILE);
+ monitor_update_events(log_path);
sleep(monitor_config.interval);
}
}