Venkatesh Laguduva
Venkatesh Laguduva

Reputation: 14408

Grafana email does not have the right url when root_url is set to '%(protocol)s://%(domain)s:%(http_port)s/grafana'

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: [email protected]
    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?

Upvotes: 5

Views: 4101

Answers (1)

Matt Clark
Matt Clark

Reputation: 28629

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/'

Upvotes: 3

Related Questions