ClientConfig¶
- class wwt_api_client.constellations.ClientConfig(id_provider_url: str, client_id: str, api_url: str)[source]¶
Bases:
objectConfiguration settings for a WWT Constellations client.
These influence which instance of the API the client actually connects to.
Methods Summary
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_URLto something else, such ashttp://localhost:7000for the default local testing configuration.The “sensible default” settings are determined in the following way:
If the environment variable
NUXT_PUBLIC_API_URLis 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.orgis used.If the environment variable
NUXT_PUBLIC_KEYCLOAK_URLis set, its value used as the base URL for the authentication service.Otherwise, if the environment variable
KEYCLOAK_URLis set, its value is used.Otherwise, if the base API URL contains the string
localhost, the valuehttp://localhost:8080is used. This is the default used by the standard Keycloak Docker image.Otherwise, if the base API URL contains the string
worldwidetelescope.org, the valuehttps://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 valuehttps://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/constellationsis appended.Finally, if the environment variable
WWT_API_CLIENT_IDis 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.