Skip to content

Cannot "inject" values for email templates from files #665

Open
@till

Description

@till

Preflight checklist

Ory Network Project

No response

Describe the bug

I am trying to customize the email templates using external files as the values file from your helm chart gets longer and longer, and longer.

So far, I only get a config map rendered that contains the values from the file though, e.g. {{.Values.email_recovery}} but I expected to see the values of the files I inject with --set-file.

Reproducing the bug

kratos:
  emailTemplates:
    recovery:
      valid:
        subject: Recover access to your account
        body: |-
          {{ .Values.email_recovery }}
        plainBody: |-
          {{ .Values.email_recovery_txt }}
      invalid:
        subject: Account access attempted
        body: |-
          {{ .Values.email_recovery_invalid }}
        plainBody: |-
          {{ .Values.email_recovery_invalid_txt }}

I tried it with:

        helm template --debug
        --values kratos/values.yml
        --values kratos/values.local.yml
        --set-file user_schema=kratos/chema.json,email_recovery=kratos/emails/recovery.html,email_recovery_txt=kratos/emails/recovery.txt,email_recovery_invalid=kratos/emails/recovery-invalid.html,email_recovery_invalid_txt=kratos/emails/recovery-invalid.txt,email_verification=kratos/emails/verification.html,email_verification_txt=kratos/emails/verification.txt,email_verification_invalid=kratos/emails/verification-invalid.html,email_verification_invalid_txt=kratos/emails/verification-invalid.txt
        --version 0.37.0
        ory-kratos ory/kratos

This renders a config map like:

# Source: kratos/templates/configmap-templates.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: ory-kratos-template-recovery-invalid
  namespace: default
  labels:
    app.kubernetes.io/name: kratos
    helm.sh/chart: kratos-0.37.0
    app.kubernetes.io/instance: ory-kratos
    app.kubernetes.io/version: "v1.0.0"
    app.kubernetes.io/managed-by: Helm
  annotations:
data:
  "email.subject.gotmpl": |
    Account access attempted
  "email.body.gotmpl": |-
    {{ .Values.email_recovery_invalid }}
  "email.body.plaintext.gotmpl": |-
    {{ .Values.email_recovery_invalid_txt }}
---
# Source: kratos/templates/configmap-templates.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: ory-kratos-template-recovery-valid
  namespace: default
  labels:
    app.kubernetes.io/name: kratos
    helm.sh/chart: kratos-0.37.0
    app.kubernetes.io/instance: ory-kratos
    app.kubernetes.io/version: "v1.0.0"
    app.kubernetes.io/managed-by: Helm
  annotations:
data:
  "email.subject.gotmpl": |
    Recover access to your account
  "email.body.gotmpl": |-
    {{ .Values.email_recovery }}
  "email.body.plaintext.gotmpl": |-
    {{ .Values.email_recovery_txt }}
---
# Source: kratos/templates/configmap-templates.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: ory-kratos-template-verification-invalid
  namespace: default
  labels:
    app.kubernetes.io/name: kratos
    helm.sh/chart: kratos-0.37.0
    app.kubernetes.io/instance: ory-kratos
    app.kubernetes.io/version: "v1.0.0"
    app.kubernetes.io/managed-by: Helm
  annotations:
data:
  "email.subject.gotmpl": |
    Email verification failed
  "email.body.gotmpl": |-
    {{ .Values.email_verification_invalid }}
  "email.body.plaintext.gotmpl": |-
    {{ .Values.email_verification_invalid_txt }}
---
# Source: kratos/templates/configmap-templates.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: ory-kratos-template-verification-valid
  namespace: default
  labels:
    app.kubernetes.io/name: kratos
    helm.sh/chart: kratos-0.37.0
    app.kubernetes.io/instance: ory-kratos
    app.kubernetes.io/version: "v1.0.0"
    app.kubernetes.io/managed-by: Helm
  annotations:
data:
  "email.subject.gotmpl": |
    Please verify your email address
  "email.body.gotmpl": |-
    {{ .Values.email_verification }}
  "email.body.plaintext.gotmpl": |-
    {{ .Values.email_verification_txt }}

Relevant log output

No error

Relevant configuration

No response

Version

0.37.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes with Helm

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions