ClientConfig

class wwt_api_client.constellations.ClientConfig(id_provider_url: str, client_id: str, api_url: str)[source]

Bases: object

Configuration settings for a WWT Constellations client.

These influence which instance of the API the client actually connects to.

Methods Summary

new_default()

Create a new client configuration with sensible default settings.

new_dev()

Create a new client configuration explicitly set up for the WWT Constellations development environment.

new_prod()

Create a new client configuration explicitly set up for the WWT Constellations production environment.

Methods Documentation

classmethod new_default() ClientConfig[source]

Create a new client configuration with sensible default settings.

This method defaults to using the public, production WWT Constellations service. To override the backend, set NUXT_PUBLIC_API_URL to something else, such as http://localhost:7000 for the default local testing configuration.

The “sensible default” settings are determined in the following way:

  • If the environment variable NUXT_PUBLIC_API_URL is set, its value used as the base URL for all API calls. (The name of this variable aligns with the one used by the Constellations frontend server.)

  • Otherwise, https://api.worldwidetelescope.org is used.

  • If the environment variable NUXT_PUBLIC_KEYCLOAK_URL is set, its value used as the base URL for the authentication service.

  • Otherwise, if the environment variable KEYCLOAK_URL is set, its value is used.

  • Otherwise, if the base API URL contains the string localhost, the value http://localhost:8080 is used. This is the default used by the standard Keycloak Docker image.

  • Otherwise, if the base API URL contains the string worldwidetelescope.org, the value https://worldwidetelescope.org/auth/ is used. This is the setting for the WWT Constellations production environment.

  • Otherwise, if the base API URL contains the string wwtelescope.dev, the value https://wwtelescope.dev/auth/ is used. This is the setting for the WWT Constellations development environment.

  • Otherwise, an error is raised

  • The base API URL is normalized to not end in a slash

  • The base authentication URL is normalized to end in a slash; then the text realms/constellations is appended.

  • Finally, if the environment variable WWT_API_CLIENT_ID is set, its value is used to set the client ID.

  • Otherwise it defaults to automation.

classmethod new_dev() ClientConfig[source]

Create a new client configuration explicitly set up for the WWT Constellations development environment.

You should probably use new_default() unless you explicitly want your code to always refer to the development environment.

classmethod new_prod() ClientConfig[source]

Create a new client configuration explicitly set up for the WWT Constellations production environment.

You should probably use new_default() unless you explicitly want your code to always refer to the production environment.