Skip to content

Commit 3cbdae6

Browse files
committed
Merge pull request #111 from EverythingMe/fix_graphite_settings
Fix: added JSON parsing of the Graphite settings
2 parents a0662d5 + edcf066 commit 3cbdae6

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

redash/data/manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ def start_workers(self, workers_count, connection_type, connection_string):
158158
runner = query_runner_mysql.mysql(connection_string)
159159
elif connection_type == 'graphite':
160160
from redash.data import query_runner_graphite
161-
runner = query_runner_graphite.graphite(connection_string)
161+
connection_params = json.loads(connection_string)
162+
if connection_params['auth']:
163+
connection_params['auth'] = tuple(connection_params['auth'])
164+
else:
165+
connection_params['auth'] = None
166+
runner = query_runner_graphite.graphite(connection_params)
162167
else:
163168
from redash.data import query_runner
164169
runner = query_runner.redshift(connection_string)

redash/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def array_from_string(str):
3939
# Connection string for the database that is used to run queries against. Examples:
4040
# -- mysql: CONNECTION_STRING = "Server=;User=;Pwd=;Database="
4141
# -- pg: CONNECTION_STRING = "user= password= host= port=5439 dbname="
42-
# -- graphite: CONNECTION_STRING = {'url': 'https://graphite.yourcompany.com', 'auth': ('user', 'password'), 'verify': True}
42+
# -- graphite: CONNECTION_STRING = {"url": "https://graphite.yourcompany.com", "auth": ["user", "password"], "verify": true}
4343
CONNECTION_STRING = os.environ.get("REDASH_CONNECTION_STRING", "user= password= host= port=5439 dbname=")
4444

4545
# Connection settings for re:dash's own database (where we store the queries, results, etc)

0 commit comments

Comments
 (0)