Skip to content

Commit

Permalink
feat: allow env substitution in the config file through secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
paolofacchinetti committed Oct 30, 2024
1 parent 2dbec96 commit f5a8051
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions charts/erpc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ spec:
{{- end }}
securityContext:
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
envFrom:
- secretRef:
name: {{ include "erpc.fullname" . }}-envs
volumeMounts:
- name: config
mountPath: /erpc.yaml
Expand Down
10 changes: 10 additions & 0 deletions charts/erpc/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "erpc.fullname" . }}-envs
labels:
{{- include "erpc.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.secretEnv }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
10 changes: 6 additions & 4 deletions charts/erpc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ config: |
projects:
- id: main
upstreams:
- endpoint: alchemy://XXXXXXXXXXX
- endpoint: alchemy://${ALCHEMY_API_KEY}
# -- Secret env variables injected via a created secret
# These env variables can be used to populate the erpc config file with sensitive data such as RPC API keys
secretEnv:
ALCHEMY_API_KEY: XXXXXXXXXX

# - HTTP port for erpc
httpPort: 4000
Expand Down Expand Up @@ -193,9 +198,6 @@ extraPorts: []
# -- Additional env variables
extraEnv: []

# -- Additional env variables injected via a created secret
secretEnv: {}

persistence:
# -- Uses an EmptyDir when not enabled
enabled: false
Expand Down

0 comments on commit f5a8051

Please sign in to comment.