lanl / 4DGB

4D Genome Browser project
1 stars 2 forks source link

Update clients for production server, and fix tests #57

Closed camtauxe closed 2 years ago

camtauxe commented 3 years ago

This PR updates the two client programs (GTK/Client.js for Javascript, gentk for Python) to be compatible with the production version of the server (i.e. they can now use HTTPS and basic authentication).

For the Python client, you need only include the https:// in the url, and also include the auth keyword argument to the client constructor. The auth argument takes a string the username and password separated by a colon (:).

Example: gentk.client.client('https://localhost', 443, auth="cameron:mypassword")

PLEASE NOTE: The changes to the Javascript client are not backwards compatible. The hostname and port are now specified together in a single argument (just include the port in the url). To include basic auth, add an additional object to the arguments with an auth field specifying the username and password (as a colon-separated string).

Example: new Client('https://localhost:443', { auth: "cameron:mypassword" })

When running the browser, none of this necessary. Instead, simply give no arguments to the Client constructor and the browser will simply fetch from the same origin as the website.

Example: new Client()

This PR also updates the test scripts and workflows so that they work with these changes. There's a new test script test_gentk_production.py which tests against the production server, although it's not currently part of any GitHub actions workflow, so you need to manually build and set-up the container before running it.