File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
4
4
new(
5
5
name,
6
6
data_source_uri='$(HOSTNAME):$(PORT)/postgres' ,
7
+ data_source_name='' ,
7
8
ssl=true ,
8
9
image='quay.io/prometheuscommunity/postgres-exporter:v0.10.0' ,
9
10
):: {
@@ -28,10 +29,18 @@ local k = import 'ksonnet-util/kausal.libsonnet';
28
29
1 ,
29
30
[
30
31
this.container
31
- // Force DATA_SOURCE_URI to be declared after the variables it references
32
- + container.withEnvMap({
33
- DATA_SOURCE_URI: data_source_uri + ssl_suffix,
34
- }),
32
+ // If data_source_name is not empty, use it instead of data_source_uri
33
+ // with variable name DATA_SOURCE_NAME
34
+ // Otherwise, use data_source_uri with variable name DATA_SOURCE_URI
35
+ + (
36
+ if data_source_name != ''
37
+ then container.withEnvMap({
38
+ DATA_SOURCE_NAME: data_source_name + ssl_suffix,
39
+ })
40
+ else container.withEnvMap({
41
+ DATA_SOURCE_URI: data_source_uri + ssl_suffix,
42
+ })
43
+ ),
35
44
]
36
45
),
37
46
},
You can’t perform that action at this time.
0 commit comments