Remote config endpoint
The Vizzly Query Engine can be set up to fetch a config from a remote location on a per-user basis.
The endpoint that you define will return a full Vizzly config as the JSON response body.
Define the endpoint
You can set the VIZZLY_REMOTE_CONFIG_ENDPOINT
environment variable on the Vizzly Query Engine. The value should be an absolute URL where we can fetch the Vizzly Config from.
For example
VIZZLY_REMOTE_CONFIG_ENDPOINT=https://api.my-company.org/vizzly-config
Providing an auth token
The query engine will forward any value received in the request header Auth-Remote-Config-Token
to your endpoint in an Authorization
request header.
You can use the advanced usage of the queryEngineEndpoint property to this header. By setting the Auth-Remote-Config-Token
header in the customHeaders
section you will be able to provide tokens that authorize requests to your remote config endpoint for specific users and remote user-specific configs.
For example
<Vizzly.Dashboard
queryEngineEndpoint={{
// URL of the Dynamic Query Engine
endpoint: 'https://vizzly-query-engine.my-company.org',
customHeaders: () => ({
'Auth-Remote-Config-Token': << TOKEN >>,
}),
}}
// Other react dashboard props...
/>
Where << TOKEN >>
is any string token you wish to identify a user and grant access to a dynamic config from your remote endpoint.
Building the remote config endpoint
Finally, we need to return a Vizzly config from a GET request sent to your remote config endpoint. Typically this endpoint will reside on your API where you can perform the following steps;
- Validate the user access token sent in the
Authorization
header. - Using your internal systems, understand which data sets need to be built, and the fields in each.
- Build the Vizzly config containing these data sets.
- Return the Vizzly config as the content of the response body with the
application/json
content type response header.