From a5137be09173ebe60e708e71e2162193338731a4 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Fri, 4 Apr 2025 23:18:54 +0200 Subject: Fixed makefile, added port config --- src/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 67c4559..302c88e 100644 --- a/src/main.c +++ b/src/main.c @@ -21,6 +21,8 @@ # define DEFAULT_DATABASE_PATH "./jals.db" #endif +unsigned short HTTPPORT; + struct connarg { void* dylib; query_func query; @@ -105,7 +107,9 @@ struct MHD_Daemon *init(sigset_t *sigset, const char *dlpath, const char *dbpath sigset_t oldmask; pthread_sigmask(SIG_BLOCK, &newmask, sigset); /* To prevent MHD from recieving the signal */ - struct MHD_Daemon *daemon = MHD_start_daemon(MHD_USE_ERROR_LOG | MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD, 8080, NULL, NULL, process_connection, &arg, MHD_OPTION_END); + const char* httpport_envp = getenv("HTTPPORT"); + HTTPPORT = httpport_envp ? atoi(httpport_envp) : 8080; + struct MHD_Daemon *daemon = MHD_start_daemon(MHD_USE_ERROR_LOG | MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD, HTTPPORT, NULL, NULL, process_connection, &arg, MHD_OPTION_END); pthread_sigmask(SIG_UNBLOCK, &newmask, NULL); if (daemon == NULL) LFAILV("could not initialize daemon"); -- cgit v1.2.3-70-g09d2