[AAP-50446] Error handling enhancements and GATEWAY_BASE_URL override (#7037)

* Added better error handling and messaging when the service token authentication is broken.  Allowed for GATEWAY_BASE_URL to override the service token's base url if it is set in the environment variables.
Co-Authored-By: Cursor (claude-4-sonnet)

* Removed GATEWAY_BASE_URL override for service token auth.
This commit is contained in:
Andrew Potozniak
2025-07-30 13:55:22 -04:00
committed by thedoubl3j
parent c5fb0c351d
commit d452098123
2 changed files with 48 additions and 1 deletions

View File

@@ -103,6 +103,14 @@ class Command(BaseCommand):
self.stdout.write(self.style.SUCCESS(f'Skip SSL Verification: {not resource_api_client.verify_https}'))
self.stdout.write(self.style.SUCCESS(f'Connection Validated: {response.status_code == 200}'))
if response.status_code != 200:
self.stdout.write(
self.style.ERROR(
f'Gateway Service Token is unable to connect to Gateway via the base URL {resource_api_client.base_url}. Recieved HTTP response code {response.status_code}'
)
)
sys.exit(1)
# Create Gateway client and run migrations
try:
self.stdout.write(self.style.SUCCESS('\n=== Connecting to Gateway ==='))