From fdf56166bc0c8c025d397aa8b84f79fd41d8e3ba Mon Sep 17 00:00:00 2001 From: Andy Wick Date: Fri, 6 Dec 2024 17:51:53 -0500 Subject: [PATCH] add ARKIME_default__ support for env vars (#3052) --- CHANGELOG | 1 + capture/config.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 04860b8bd..c82e06fbc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -39,6 +39,7 @@ NOTICE: Create a parliament config file before upgrading (see https://arkime.com - #3037 remove babel ## Capture - #3046 added packet-stats command + - #3052 add ARKIME_default__ support for env vars 5.5.1 2024/11/20 ## Release diff --git a/capture/config.c b/capture/config.c index 183073205..20bc719db 100644 --- a/capture/config.c +++ b/capture/config.c @@ -1424,8 +1424,9 @@ void arkime_config_init() { extern char **environ; for (int e = 0; environ[e]; e++) { - if (strncmp(environ[e], "ARKIME__", 8) == 0) { - const char *equal = strchr(environ[e] + 8, '='); + if (strncmp(environ[e], "ARKIME__", 8) == 0 || strncmp(environ[e], "ARKIME_default__", 16) == 0) { + int offset = environ[e][7] == '_' ? 8 : 16; + const char *equal = strchr(environ[e] + offset, '='); if (!equal) continue; @@ -1433,7 +1434,7 @@ void arkime_config_init() config.override = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); } - char *key = g_strndup(environ[e] + 8, equal - environ[e] - 8); + char *key = g_strndup(environ[e] + offset, equal - environ[e] - offset); if (g_hash_table_contains(config.override, key)) { g_free(key); } else {