Skip to content

Commit

Permalink
Use sane sections for overrides with wise/cont3xt/parliament (arkime#…
Browse files Browse the repository at this point in the history
…3122)

* Use sane sections for overrides with wise/cont3xt/parliament

For example -o foo=bar with cont3xt will set cont3xt.foo=bar
wiseService.foo=bar and parliament.foo=bar

* codeql is broken
  • Loading branch information
awick authored Feb 10, 2025
1 parent 170fcdd commit 6af4636
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 93 deletions.
87 changes: 0 additions & 87 deletions .github/workflows/codeql.yml

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ NOTICE: Create a parliament config file before upgrading (see https://arkime.com
section name for those respective applications
- #3110 can now use https://usersElasticsearch in url/config and Arkime will
fill in from the env/config
- #3122 if no section used for override, use something sane
## Capture
- #3100 fix SSLv2 constants and misidentify DTLS 0 (thanks @droe)
## db.pl
Expand Down
8 changes: 7 additions & 1 deletion cont3xt/cont3xt.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,13 @@ function processArgs (argv) {
console.log('Missing equal sign in', process.argv[i]);
process.exit(1);
}
ArkimeConfig.setOverride(process.argv[i].slice(0, equal), process.argv[i].slice(equal + 1));
const key = process.argv[i].slice(0, equal);
const value = process.argv[i].slice(equal + 1);
if (key.includes('.')) {
ArkimeConfig.setOverride(key, value);
} else {
ArkimeConfig.setOverride('cont3xt.' + key, value);
}
} else if (argv[i] === '--help') {
console.log('cont3xt.js [<options>]');
console.log('');
Expand Down
8 changes: 7 additions & 1 deletion parliament/parliament.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ const internals = {
console.log('Missing equal sign in', process.argv[i]);
process.exit(1);
}
ArkimeConfig.setOverride(process.argv[i].slice(0, equal), process.argv[i].slice(equal + 1));
const key = process.argv[i].slice(0, equal);
const value = process.argv[i].slice(equal + 1);
if (key.includes('.')) {
ArkimeConfig.setOverride(key, value);
} else {
ArkimeConfig.setOverride('parliament.' + key, value);
}
} else if (process.argv[i] === '-n' || process.argv[i] === '--name') {
internals.parliamentName = process.argv[++i];
} else if (process.argv[i] === '--help') {
Expand Down
9 changes: 6 additions & 3 deletions tests/config.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ my ($out, $es, $url);
#### ENV
my $testenv='ARKIME_ignore=ignore ARKIME__foo1=foo1 ARKIME_default__foo2=foo2 ARKIME_foo_fooDOTDASHCOLON__foo3=foo3 ARKIME_node__fooDASH4=4 ARKIME_overrideDASHips__10DOT1DOT0DOT0SLASH16="tag:ny-office;country:USA;asn:AS0000 This is neat"';

$out = `$testenv node ../viewer/viewer.js -c testconfig.ini -o foo=bar -n test --regressionTests --dumpConfig 2>&1 1>/dev/null`;
$out = `$testenv node ../viewer/viewer.js -c testconfig.ini -o foo=bar -o default.bar=foo -n test --regressionTests --dumpConfig 2>&1 1>/dev/null`;
eq_or_diff(from_json($out), from_json('{
"OVERRIDE": {
"default.bar": "foo",
"default.foo": "bar",
"test.foo": "bar"
},
Expand All @@ -58,9 +59,10 @@ eq_or_diff(from_json($out), from_json('{
}
}'));

$out = `$testenv node ../cont3xt/cont3xt.js -c testconfig.ini -o cont3xt.foo=bar --regressionTests --dumpConfig 2>&1 1>/dev/null`;
$out = `$testenv node ../cont3xt/cont3xt.js -c testconfig.ini -o cont3xt.foo=bar -o bar=foo --regressionTests --dumpConfig 2>&1 1>/dev/null`;
eq_or_diff(from_json($out), from_json('{
"OVERRIDE": {
"cont3xt.bar": "foo",
"cont3xt.foo": "bar"
},
"CONFIG": {
Expand All @@ -84,10 +86,11 @@ eq_or_diff(from_json($out), from_json('{
}
}'));

$out = `$testenv node ../wiseService/wiseService.js -c testconfig.ini -o wiseService.foo=bar --regressionTests --dumpConfig 2>&1 1>/dev/null`;
$out = `$testenv node ../wiseService/wiseService.js -c testconfig.ini -o wiseService.foo=bar -o bar=foo --regressionTests --dumpConfig 2>&1 1>/dev/null`;
$out =~ s/^\[.*\] //mg;
eq_or_diff(from_json($out), from_json('{
"OVERRIDE": {
"wiseService.bar": "foo",
"wiseService.foo": "bar"
},
"CONFIG": {
Expand Down
8 changes: 7 additions & 1 deletion wiseService/wiseService.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ function processArgs (argv) {
process.exit(1);
}

ArkimeConfig.setOverride(process.argv[i].slice(0, equal), process.argv[i].slice(equal + 1));
const key = process.argv[i].slice(0, equal);
const value = process.argv[i].slice(equal + 1);
if (key.includes('.')) {
ArkimeConfig.setOverride(key, value);
} else {
ArkimeConfig.setOverride('wiseService.' + key, value);
}
} else if (argv[i] === '--webcode') {
i++;
internals.configCode = argv[i];
Expand Down

0 comments on commit 6af4636

Please sign in to comment.