Monitoring: unable to set extraVars for Grafana

I have enabled the monitoring through the UI and all the resources were successfully created and the monitoring is correctly working.

I want to send an alert by email but I need to configure the SMTP host. I tried to add the env variabile through the “cluster-monitoring” chart by setting the extraVars by adding the answers in the following way:

grafana.extraVars[0].name=GF_SMTP_ENABLED
grafana.extraVars[0].value=true
grafana.extraVars[1].name=GF_SMTP_HOST
grafana.extraVars[1].value=*
grafana.extraVars[2].name=GF_SERVER_DOMAIN
grafana.extraVars[2].value=*
grafana.extraVars[3].name=GF_SMTP_FROM_ADDRESS
grafana.extraVars[3].value=*

but I receive this error:

Failed to install app cluster-monitoring. Error: UPGRADE FAILED: failed to create patch: failed to get versionedObject: unable to convert unstructured object to apps/v1, Kind=Deployment: unrecognized type: string 

I think that the problem is the value “true” of the first object.
How can I make it accept the value “true”?

If I do not add the first object with the value “true”, I am able to add the variables (I see them in the environment variable section), but they disappear because of the pod initialization process which deletes the container before initializing it.
If I add manually the variables to the Grafana container, I am able to configure SMTP correctly, but I need a way to configure it via chart variables.
How can I persist that environment variables?

Rancher version: 2.2.4
Monitoring chart version: 0.0.3

Thanks

I solved it by applying the answers in the Tools > Monitoring menu. In this way the options are applied even if the pods restart.

For the value true, the solution was to pass it in this way:

grafana.extraVars[0].value="true"

because it is a string in the yaml, not a boolean.