treebird-docker/files/instance_env_main.c.patch
ICScaryThings 2c090f71df Reworked container build to allow setting instance url at runtime
I patched neko's code to use getenv() to grab instance url at startup and store
it as a global rather than static const.
2022-06-28 23:02:34 -04:00

29 lines
640 B
Diff

diff --git a/src/main.c b/src/main.c
index fc5cc79..6f3d8bc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,7 +20,6 @@
#include <string.h>
#include <mastodont.h>
#include <stdlib.h>
-#include "../config.h"
#include "index.h"
#include "page_config.h"
#include "path.h"
@@ -41,10 +40,16 @@
#include "local_config_set.h"
#include "global_cache.h"
+// global accessed elsewhere via extern def in config.h
+char* config_instance_url = NULL;
+
int main(void)
{
unsigned run_count = 1;
+ // Env config
+ config_instance_url = getenv("TREEBIRD_CFG_INSTANCE_URL");
+
// Global init
mastodont_global_curl_init();