Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit dae3a79

Browse files
committed
Add ability to configure the elasticsearch index prefix
1 parent b06b6bb commit dae3a79

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

persistence/persistence-elastic/persist.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ async function persist({
3838
scan,
3939
now = new Date(),
4040
tenant = process.env["NAMESPACE"],
41+
indexPrefix = process.env["ELASTICSEARCH_INDEX_PREFIX"] || "scbv2",
4142
}) {
4243
const findings = await getFindings();
4344

@@ -47,7 +48,7 @@ async function persist({
4748
);
4849

4950
const timeStamp = now.toISOString().substr(0, 10);
50-
const indexName = `scbv2_${tenant}_${timeStamp}`;
51+
const indexName = `${indexPrefix}_${tenant}_${timeStamp}`;
5152

5253
await client.indices.create(
5354
{

persistence/persistence-elastic/templates/persistence-provider.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ metadata:
77
spec:
88
image: "scbexperimental/persistence-elastic:latest"
99
env:
10+
- name: ELASTICSEARCH_INDEX_PREFIX
11+
value: {{ .Values.indexPrefix | quote }}
1012
{{- if .Values.externalElasticStack.enabled }}
1113
- name: ELASTICSEARCH_ADDRESS
1214
value: {{ .Values.externalElasticStack.elasticsearchAddress | quote }}

persistence/persistence-elastic/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ image:
66
repository: scbexperimental/persistence-elastic
77
pullPolicy: Always
88

9+
indexPrefix: "scbv2"
10+
911
# Enable this when you already have an Elastic Stack running to which you want to send your results
1012
externalElasticStack:
1113
enabled: false

0 commit comments

Comments
 (0)