diff options
author | justanothercatgirl <sotov@twistea.su> | 2025-04-04 23:18:54 +0200 |
---|---|---|
committer | justanothercatgirl <sotov@twistea.su> | 2025-04-04 23:25:13 +0200 |
commit | a5137be09173ebe60e708e71e2162193338731a4 (patch) | |
tree | 2b70e2fb37de09ef69fcad101208f63fe9ad0811 /src/main.c | |
parent | 3ee36bbfe99c10c8b788ba80db8e4338913b818e (diff) |
Fixed makefile, added port config
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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"); |