unioslo / tsd-api-client

Command line client for the TSD HTTP API
BSD 3-Clause "New" or "Revised" License
13 stars 5 forks source link

Use HTTPS for connectivity checks #123

Closed haatveit closed 9 months ago

haatveit commented 9 months ago

In Educloud, non-HTTP(s) traffic is not being routed out to external IPv4 hosts, so our previous connectivity test using a TCP socket would fail there despite the API being usable.

I've rewritten the check to perform a GET for the domain root using requests, with anything other than 403 being accepted as success, as we don't currently offer any kind of info or health endpoint that could be used here.

The PR also adds an environment variable for just disabling all checks outright. If TACL_DISABLE_API_CONNECTION_CHECK is set, no checks will be run.