Skip to content

Commit

Permalink
add ARKIME_default__ support for env vars (arkime#3052)
Browse files Browse the repository at this point in the history
  • Loading branch information
awick authored Dec 6, 2024
1 parent d723c9f commit fdf5616
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions capture/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,16 +1424,17 @@ 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;

if (!config.override) {
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 {
Expand Down

0 comments on commit fdf5616

Please sign in to comment.