aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c6
1 files changed, 5 insertions, 1 deletions
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");