Disable hotreloading in prod

This commit is contained in:
kamkow1
2025-06-20 01:09:16 +02:00
parent 540b3a1567
commit edc039db6e
11 changed files with 36 additions and 29 deletions

View File

@ -1,7 +1,9 @@
#include "gebs/gebs.h"
#include "mongoose/mongoose.h"
#include "cJSON/cJSON.h"
#if MY_DEBUG
#include "md5-c/md5.h"
#endif
#include "routes.h"
#include "baked.h"
@ -72,6 +74,7 @@ bool gpp_run(char *path, NString_List *env, String_Builder *out)
return cmd_run_collect(&cmd, out) == 0;
}
#if MY_DEBUG
ROUTE_HANDLER(build_id)
{
cJSON *root = cJSON_CreateObject();
@ -91,6 +94,7 @@ ROUTE_HANDLER(build_id)
make_application_json(result, 200, root);
}
#endif
ROUTE_HANDLER(page_not_found)
{
@ -113,10 +117,8 @@ ROUTE_HANDLER(page_not_found)
get_timer_string(timer, sizeof(timer));
list_append(&env, fmt("-DRUNNING_SINCE=%s", timer));
#if DEBUG
list_append(&env, "-DHOTRELOAD=1");
#else
list_append(&env, "-DHOTRELOAD=0");
#if MY_DEBUG
list_append(&env, "-DHOTRELOAD");
#endif
bool ok = gpp_run(path, &env, &out);
@ -167,6 +169,7 @@ ROUTE_HANDLER(favicon)
make_image_xicon(result, 200, sb.items);
}
#if MY_DEBUG
ROUTE_HANDLER(hotreload_js)
{
char path[PATH_MAX] = {0};
@ -185,6 +188,7 @@ ROUTE_HANDLER(hotreload_js)
make_text(result, "javascript", 200, sb.items);
}
#endif
ROUTE_HANDLER(home)
{
@ -205,10 +209,8 @@ ROUTE_HANDLER(home)
get_timer_string(timer, sizeof(timer));
list_append(&env, fmt("-DRUNNING_SINCE=%s", timer));
#if DEBUG
list_append(&env, "-DHOTRELOAD=1");
#else
list_append(&env, "-DHOTRELOAD=0");
#if MY_DEBUG
list_append(&env, "-DHOTRELOAD");
#endif
bool ok = gpp_run(path, &env, &out);
@ -242,10 +244,8 @@ ROUTE_HANDLER(generic_blog)
get_timer_string(timer, sizeof(timer));
list_append(&env, fmt("-DRUNNING_SINCE=%s", timer));
#if DEBUG
list_append(&env, "-DHOTRELOAD=1");
#else
list_append(&env, "-DHOTRELOAD=0");
#if MY_DEBUG
list_append(&env, "-DHOTRELOAD");
#endif
String_Builder md = {0};
@ -333,10 +333,8 @@ ROUTE_HANDLER(blog)
get_timer_string(timer, sizeof(timer));
list_append(&env, fmt("-DRUNNING_SINCE=%s", timer));
#if DEBUG
list_append(&env, "-DHOTRELOAD=1");
#else
list_append(&env, "-DHOTRELOAD=0");
#if MY_DEBUG
list_append(&env, "-DHOTRELOAD");
#endif
bool ok = gpp_run(path, &env, &out);