Skip to content

Commit

Permalink
Merge pull request #162 from QCDIS/161-add-allow_insecure_tls-environ…
Browse files Browse the repository at this point in the history
…ment-variable

skip argo SSL verification based on $ALLOW_INSECURE_TLS
  • Loading branch information
gpelouze authored Oct 26, 2023
2 parents 6fdfc92 + 01f36b9 commit 728d91e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions vreapis/vreapis/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
r'^http:\/\/localhost:\d+$',
]

ALLOW_INSECURE_TLS = (os.getenv('ALLOW_INSECURE_TLS', 'false').lower() ==
'true')

KEYCLOAK_EXEMPT_URIS = []
#
KEYCLOAK_CONFIG = {
Expand Down
11 changes: 8 additions & 3 deletions vreapis/workflows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated

from django.conf import settings

from virtual_labs.models import VirtualLab
from vreapis.views import GetSerializerMixin

Expand Down Expand Up @@ -77,7 +79,8 @@ def list(self, request, *args, **kwargs):
call_url,
headers={
'Authorization': argo_api_token
}
},
verify=(not settings.ALLOW_INSECURE_TLS),
)
logger.debug('------------------------------------------------------------------------')
logger.debug('resp_list: ' + str(resp_list))
Expand Down Expand Up @@ -140,7 +143,8 @@ def submit(self, request, *args, **kwargs):
json=workflow,
headers={
'Authorization': argo_api_token
}
},
verify=(not settings.ALLOW_INSECURE_TLS),
)

if resp_submit.status_code != 200:
Expand All @@ -152,7 +156,8 @@ def submit(self, request, *args, **kwargs):
json=workflow,
headers={
'Authorization': argo_api_token
}
},
verify=(not settings.ALLOW_INSECURE_TLS),
)
if resp_detail.status_code != 200:
return Response(resp_submit.text, status=resp_detail.status_code)
Expand Down

0 comments on commit 728d91e

Please sign in to comment.