Support an ENV passed header for authentication using API key:value
jjgit-hub opened this issue · 1 comments
jjgit-hub commented
I have a Grafana environment that requires the use of authentication using the API key:value in the http header. I found this is possible to do by passing in the key:value auth using the Environment GRAFANA_HEADERS. However, the authentication fails because HTTP_GET_HEADERS sets a blank TOKEN value. I have a small patch to GrafanaSettings.py to skip the Authorization: Bearer header when it is not set.
if len(TOKEN) > 0:
HTTP_GET_HEADERS = {'Authorization': 'Bearer ' + TOKEN}
HTTP_POST_HEADERS = {'Authorization': 'Bearer ' + TOKEN, 'Content-Type': 'application/json'}
else:
HTTP_GET_HEADERS = {}
HTTP_POST_HEADERS = {'Content-Type': 'application/json'}
Please consider including the above patch or something better :).
ysde commented
@jjgit-hub thank you for the advice