apiVersion: v1
kind: Secret
metadata:
  name: {{ .Release.Name }}-vpn
type: Opaque
stringData:
  shadowbox_server_config.json: |
    {
      "rollouts": [
        {
          "id": "single-port",
          "enabled": true
        }
      ],
      "portForNewAccessKeys": 40000,
      "hostname": "localhost"
    }
  shadowbox_config.json: |
    {
      "accessKeys": [
        {{- $c := 1 | int }}
        {{- range $user, $u := .Values.users }}
        {{- if ne $c 1 }},{{ end }}
        {
          "id": "{{ $c }}",
          "metricsId": "{{ $user }}",
          "name": "{{ $user }}",
          "password": "{{ $u.password }}",
          "port": 40000,
          "encryptionMethod": "chacha20-ietf-poly1305"
        }
        {{- $c = add1 $c }}
        {{- end }}
      ],
      "nextId": {{ $c }}
    }
