Mercurial
diff mrjunejune/main.c @ 265:056790c4fb0d
add role-aware Epi assistant prompts
Add verified June knowledge, guest/member/admin Copilot profiles, profile-isolated session recovery, animated Epi greetings, and a single authoritative runtime config workflow for inference.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 10:50:30 -0700 |
| parents | 04fee26ecce0 |
| children | e02e2036ef84 |
line wrap: on
line diff
--- a/mrjunejune/main.c Fri Aug 07 07:34:12 2026 -0700 +++ b/mrjunejune/main.c Fri Aug 07 10:50:30 2026 -0700 @@ -132,6 +132,7 @@ static void load_config(const char *config_path) { + boolean config_loaded = FALSE; FILE *f = fopen(config_path, "r"); char workspace_config_path[1024] = {0}; if (!f) @@ -155,6 +156,7 @@ } else { + config_loaded = TRUE; char line[512]; while (fgets(line, sizeof(line), f)) { @@ -269,6 +271,20 @@ { strncpy(g_server_host, value, sizeof(g_server_host) - 1); } + else if (strcmp(key, "MRJUNEJUNE_ALLOW_GUEST_INFERENCE") == 0) + { + if (strcmp(value, "1") == 0 || strcasecmp(value, "true") == 0) + g_guest_inference_enabled = TRUE; + else if (strcmp(value, "0") == 0 || strcasecmp(value, "false") == 0) + g_guest_inference_enabled = FALSE; + else + { + fprintf( + stderr, + "[CONFIG] ERROR: MRJUNEJUNE_ALLOW_GUEST_INFERENCE must be true or false\n"); + exit(1); + } + } else if (strcmp(key, "AUTH_GUEST_DAILY_TURNS") == 0) { int64 v; @@ -320,7 +336,7 @@ g_auth_bootstrap_username[0] ? g_auth_bootstrap_username : "(none)", g_auth_trusted_proxy[0] ? "(set)" : "(not set)"); - const char *database_path_override = getenv("DB_PATH"); + const char *database_path_override = getenv("MRJUNEJUNE_DB_PATH"); const char *test_tmpdir = getenv("TEST_TMPDIR"); if (database_path_override && database_path_override[0] != '\0') { @@ -331,8 +347,9 @@ snprintf(g_db_path, sizeof(g_db_path), "%s/mrjunejune.db", test_tmpdir); } - /* Environment overrides: env vars always take precedence over file. - * Values are never logged. */ + /* Environment configuration is a compatibility/testing fallback only when + * no config file is present. Dynamic supervisor wiring is read separately. */ + if (!config_loaded) { const char *env; @@ -355,8 +372,6 @@ } g_s3_url_expires = (int)v; } - if ((env = getenv("MRJUNEJUNE_DB_PATH")) && env[0] != '\0') - strncpy(g_db_path, env, sizeof(g_db_path) - 1); if ((env = getenv("AWS_MRJUNEJUNE_ACCESS_KEY")) && env[0] != '\0') strncpy(g_s3_access_key, env, sizeof(g_s3_access_key) - 1); if ((env = getenv("AWS_MRJUNEJUNE_SECRET_ACCESS_KEY")) && env[0] != '\0') @@ -2357,7 +2372,11 @@ signal(SIGTERM, handle_sigint); // Load the ignored runtime config when present; environment overrides follow. - load_config("mrjunejune/.config"); + const char *config_path = getenv("MRJUNEJUNE_CONFIG_PATH"); + load_config( + config_path && config_path[0] != '\0' + ? config_path + : "mrjunejune/.config"); // Initialize S3 config using global credentials populated by load_config g_s3_config.access_key_id = g_s3_access_key;