diff --git a/src/common.h b/src/common.h index 88de357..fc630bc 100644 --- a/src/common.h +++ b/src/common.h @@ -18,6 +18,6 @@ #pragma once - +#define HINT_UNUSED(var) (void)(var); // NOOP for now! diff --git a/src/main.cpp b/src/main.cpp index 3d5cf58..4b8d0e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -92,6 +92,10 @@ int start_wormhole() // Passed as std::any to each route function RouteArgs args{database.get()}; +#ifdef MODULE_FCGI + // Set FDs for FCGI http requests + args.fcgi_pipe_fds = &pipe_fds; +#endif // Start HTTPD Server std::unique_ptr server = diff --git a/src/route_args.h b/src/route_args.h index 1b9b4a2..60ab581 100644 --- a/src/route_args.h +++ b/src/route_args.h @@ -19,12 +19,27 @@ #pragma once #include +#include #include "database/database.h" +#include "common.h" + +#ifdef MODULE_FCGI +#define FCGI_PIPE(_arg) std::array* fcgi_pipe_fds = std::any_cast(_arg).fcgi_pipe_fds; \ + HINT_UNUSED(fcgi_pipe_fds); +#else +#define FCIG_PIPE(_arg) ; +#endif // Apologies if the word "DESTRUCT" is confusing here, it simply means to cast into regular variables -#define DESTRUCT_WORMHOLE_ARGS(_arg) DB::Database* db = std::any_cast(_arg).db; +#define DESTRUCT_WORMHOLE_ARGS(_arg) DB::Database* db = std::any_cast(_arg).db; \ + HINT_UNUSED(db); \ + FCGI_PIPE(_arg); + struct RouteArgs { DB::Database* db; +#ifdef MODULE_FCGI + std::array* fcgi_pipe_fds; +#endif };