Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions servicex_app/servicex_app/web/servicex_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from urllib.parse import urlparse

import flask
from flask import (request, send_file, session)
from flask import (request, send_file, session, current_app)
from servicex_app.decorators import oauth_required
from servicex_app.models import UserModel

Expand All @@ -14,7 +14,7 @@ def servicex_file():
email = session.get('email')
user = UserModel.find_by_email(email)
endpoint_url = get_correct_url(request)
endpoint_name = urlparse(endpoint_url).hostname
endpoint_name = current_app.config.get("INSTANCE_NAME", urlparse(endpoint_url).hostname)

body = "api_endpoints:\n"
body += f" - name: {endpoint_name}\n"
Expand Down
13 changes: 13 additions & 0 deletions servicex_app/servicex_app_test/web/test_servicex_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ def test_servicex_file(self, client, user):
assert response.data.decode() == dedent(expected)
assert response.headers['Content-Disposition'] == 'attachment; filename=servicex.yaml'

cfg = {'INSTANCE_NAME': 'important-instance'}
client.application.config.update(cfg)
response: Response = client.get(url_for('servicex-file'))
expected = """\
api_endpoints:
- name: important-instance
endpoint: http://localhost/
token: abcdef
default_endpoint: important-instance
"""
assert response.data.decode() == dedent(expected)
assert response.headers['Content-Disposition'] == 'attachment; filename=servicex.yaml'

def test_correct_url(self, client):
"""
Test that http endpoints are replaced with https addresses with the
Expand Down