问题
I am setting up Grafana Smtp for email invitations. I am using grafana helm chart and my configuration looks like this -
grafana.ini:
smtp:
enabled: true
host: smtp.sendemail.com:587
user: 'someuser'
password: 'somepassword'
from_address: join-grafana@somewhere.com
from_name: Join Us At Grafana
server:
root_url: '%(protocol)s://%(domain)s:%(http_port)s/grafana'
serve_from_sub_path: true
When I send email invitations, email has the link to http://localhost:3000/grafana/... not the domain name I have set; For every purpose, I am able to use the grafana url by domain name like - https://somedomain.com/grafana.
What could possibly be wrong?
回答1:
You need to actually define all the variables, else they will use the default value, which is what you are seeing in your email; if you are running through a proxy server like I do, you might need to change the URL template:
[server]
# Protocol (http, https, h2, socket)
protocol = http
# The http port to use
http_port = 3030
# The public facing domain name used to access grafana from a browser
domain = metrics.example.com
# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
root_url = 'https://%(domain)s/grafana/'
来源:https://stackoverflow.com/questions/60049258/grafana-email-does-not-have-the-right-url-when-root-url-is-set-to-protocols