Skip to content

Commit afb6d4b

Browse files
add ability to support free entry of environment variables for nango-server (#10)
This PR addresses [Allow Arbitrary Environment Variables to be set for nango-server](#9). I've attached a screenshot of a basicauth login below: <img width="1050" alt="nango-basicauth-login" src="https://github.com/user-attachments/assets/be457c83-1f5e-4237-bc82-4fb51ecebb54" /> Note that there are a _number_ of ways to support environment variables within helm charts - two options which I tested/considered are below: 1. Free-entry configuration - where a user would only provide an `env` value that renders valid YAML. This is rendered utilizing the following: ``` {{- if .Values.server.env }} {{- toYaml .Values.server.env | nindent 12 }} {{- end }} ``` 2. Iterative configuration (which is what I've seen used more frequently) - where a user provides a list composed of `name` and `value` or `valueFrom` fields which (I thought) offered a greater deal of validation (see "A Note on Iterative Configuration" below). # A Note on Iterative Configuration I was open to utilizing this as it was/is common within the kubernetes/helm community and a popular suggestion on AI sites. What I discovered was this was _worse_ than simply accepting "free entry" as it _modified_ the YAML but did not reject it - an example is below: ``` {{- range .Values.server.env }} - name: {{ .name }} {{- if .value }} value: {{ .value | quote }} {{- else if .valueFrom }} valueFrom: {{ toYaml .valueFrom | nindent 16 }} {{- end }} {{- end }} ``` When given: ``` env: - namea: FLAG_AUTH_ENABLED value: "false" - name: NANGO_DASHBOARD_USERNAME value: nango - name: NANGO_DASHBOARD_PASSWORD valueFroma: secretKeyRef: name: nango-secrets key: nango-dashboard-password ``` Would render: ``` - name: value: "false" - name: NANGO_DASHBOARD_USERNAME value: "nango" - name: NANGO_DASHBOARD_PASSWORD ```
1 parent c1a1dc7 commit afb6d4b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

charts/nango/templates/server/server-deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ spec:
7272
key: mailgun-api-key
7373
- name: SERVER_PORT
7474
value: "{{ .Values.server.SERVER_PORT }}"
75+
{{- if .Values.server.env }}
76+
{{- toYaml .Values.server.env | nindent 12 }}
77+
{{- end }}
7578
volumeMounts:
7679
{{- if .Values.shared.useVolumeForFlows }}
7780
- mountPath: {{ .Values.shared.flows_path }}

example-values.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ elasticsearch:
5555
server:
5656
name: nango-server
5757
replicas: 1
58+
# you can set /any/ nango-server environment variable required utilizing the "env" key as follows:
59+
# the example below shows a configuration to enable basic auth
60+
# env:
61+
# - name: FLAG_AUTH_ENABLED
62+
# value: "false"
63+
# - name: NANGO_DASHBOARD_USERNAME
64+
# value: nango
65+
# - name: NANGO_DASHBOARD_PASSWORD
66+
# valueFrom:
67+
# secretKeyRef:
68+
# name: nango-secrets
69+
# key: nango-dashboard-password
5870

5971
jobs:
6072
name: nango-jobs

0 commit comments

Comments
 (0)