do not use tokens for localhost

This commit is contained in:
Henning Jacobs
2016-12-19 14:06:53 +01:00
parent 9f197e63bd
commit c466a7f8fc

4
app.py
View File

@@ -30,7 +30,9 @@ def index():
def get_clusters():
clusters = []
for api_server_url in os.getenv('CLUSTERS', DEFAULT_CLUSTERS).split(','):
session.headers['Authorization'] = 'Bearer {}'.format(tokens.get('read-only'))
if 'localhost' not in api_server_url:
# TODO: hacky way of detecting whether we need a token or not
session.headers['Authorization'] = 'Bearer {}'.format(tokens.get('read-only'))
response = session.get(urljoin(api_server_url, '/api/v1/nodes'), timeout=5)
response.raise_for_status()
nodes = []