Startup Configuration#

When webvis creates a context, it collects the context's initial settings from several sources. This page explains where those sources live and which one wins when they disagree. Once the context exists, you can read and change settings via the SettingsAPI.

The initial settings of a webvis context depend on who creates it:

  • Your code calls requestContext: webvis reads the settings object you pass in, plus the hub's and the app's webvis.config.json files. It does not look at URL parameters, <webvis-config> elements or the browser's local storage.

  • A webvis UI element creates it: UI elements like <webvis-full> and <webvis-viewer> use the context named by their context attribute ("default_context" by default) and create it if it does not exist yet. In that case, the element collects the settings itself, and the rules described below do not apply:

    • Besides the config files, it also reads the <webvis-config> element, the page's URL parameters and the settings stored in the browser's local storage. The stored settings are applied last and override all other sources.
    • It loads the hub's config file from next to webvis.js, not from the final hubURL.

    If your code has already created a context with that name, the element uses it as it is and applies none of these sources.

This section applies only to contexts that your code creates via requestContext.

Sources of initial context settings, from lowest to highest priority. A later source overrides an earlier one:

  1. Built-in defaults, documented in SettingStrings and ViewerSettingStrings.
  2. The hub's config file: <hubURL>/repo/webvis/webvis.config.json.
  3. Your app's config file: webvis.config.json in the same directory as the page that runs webvis.
  4. The settings object passed to requestContext.

A config file that is missing, unreachable or not valid JSON is skipped silently, and startup continues with the remaining sources.

The hub config file comes from the hub that the context connects to, i.e. from the final hubURL. webvis takes that from the first of these that is set:

  1. hubURL in the settings object
  2. hubURL in your app's webvis.config.json
  3. If the URL of the loaded webvis.js script contains /repo/webvis/, everything before that is used as hub URL.

So if you pass a custom hubURL, the config file of that hub is loaded, not the one of the hub that served webvis.js.

Pass loadRemoteConfigFile: false in the settings object to skip both config files. Only the settings object counts here: setting loadRemoteConfigFile inside a config file does not stop the files from being loaded.

const context = await webvis.requestContext("my-context", {
    hubURL: "https://your-hub.example.com/",
    loadRemoteConfigFile: false
});