Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for environment variables to be specified inside the Grafana container. #5

Closed
erikdewildt opened this issue Jun 26, 2018 · 7 comments

Comments

@erikdewildt
Copy link

erikdewildt commented Jun 26, 2018

Problem/Motivation

I'm unable to overrule some configuration settings of Grafana.

At the moment i'm using the Grafana addon from the https://github.com/bestlibre/hassio-addons repository. This addon allows for custom configuration settings to be specified using the env_var keyword. I use this to configure proxy authentication. I authenticate on a reverse proxy which then sets a header so that Grafana skips the password request.

Unfortunately the addon in the bestlibre repo is an old version of Grafana, therefore i would like to use this addon.

Expected behavior

Allowing customer configuration settings to be specified from the hassio addon detail page.

Actual behavior

When i specify the env_var key it's removed automatically and environment variables are not available in the container.

Steps to reproduce

  1. Set the env_var key in the config dict:
{
  "env_var": [
    {
      "name": "GF_SERVER_DOMAIN",
      "value": "home.mydomain.nl"
    },
    {
      "name": "GF_SERVER_ROOT_URL",
      "value": "%(protocol)s://%(domain)s:/_grafana"
    },
    {
      "name": "GF_AUTH_PROXY_ENABLED",
      "value": "true"
    },
    {
      "name": "GF_AUTH_PROXY_HEADER_NAME",
      "value": "X-WEBAUTH-USER"
    },
    {
      "name": "GF_AUTH_PROXY_HEADER_PROPERTY",
      "value": "username"
    },
    {
      "name": "GF_USERS_ALLOW_SIGN_UP",
      "value": "false"
    },
    {
      "name": "GF_AUTH_PROXY_AUTO_SIGN_UP",
      "value": "false"
    }
  ]
}
  1. Save the config
  2. Start the addon
  3. Login to the container, check the environment variables

Proposed changes

It would be awesome if the env_var key could be parsed and the environment variables would be made available inside the grafana container.

Thanks for all your work!

GitHub
Contribute to hassio-addons development by creating an account on GitHub.
@addons-assistant
Copy link

👋 Thanks for opening your first issue here! If you're reporting a 🐛 bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be usefull.

@frenck
Copy link
Member

frenck commented Jun 26, 2018

I understand you'd like these features. Please note that this add-on is not a fork of the official Grafana docker images, so those env variables will not work.

Secondly, I'm not going to do this with env variables... ever. Hass.io provides a proper configuration mechanism, which in my opinion should be used (and not introduce a second one).

I will look into the possibilities to make these options available via the add-on configuration.

Thank you so much for the extensive ticket and pretty awesome feature request (including a proper use case) 👍

@erikdewildt
Copy link
Author

Hi Frenck,

Thanks for the response. I understand Hassio.io has an excellent configuration mechanism. What I meant was to utilise the default Grafana feature to manipulate configuration using the the GF_<SectionName>_<KeyName> environment variables as documented in the Grafana docs. This way it is not needed to render the configuration based on settings.

I've tried using the environment addon setting as stated in the docs. The docs state A dict of environment variable to run add-on. if I understand correctly these variables are ment to be passed to the container (docker run -e ... )? Unfortunately for some reason my settings are not saved and reverted automatically, not sure what I'm doing wrong.

It to me that seems that if I'm able to save settings in the environment key of the addon my feature would work.

I would be more then happy to share a small NGINX config snippet which arranges automatically login in Grafana for my local subnet.

Thanks again,
Regards,

Erik

@frenck
Copy link
Member

frenck commented Jun 28, 2018

This Hass.io environment setting you are referring to is statically configured in the add-on and cannot be modified or set by the user.

@mrfawy
Copy link

mrfawy commented Jul 26, 2018

First of all , thanks a lot Frenck for the awesome add on .
I'd like to add my voice to @erikdewildt request. My use case is that I need to send email Alerts from Grafana and to do that , I need to change smtp settings. (in docker via env_var) .

If environment settings are static , how can I do that ?

Best Regards,

@frenck frenck closed this as completed in 1fd163c Jul 30, 2018
@frenck
Copy link
Member

frenck commented Jul 30, 2018

This feature has been implemented and will be part of the next release.

@addons-assistant
Copy link

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@addons-assistant addons-assistant bot locked as resolved and limited conversation to collaborators Aug 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants