Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ import RealtimeSessions from './src/realtimeSessions/plugin.js';
import GlobalFilters from './src/globalFilters/plugin.js';
import ExportDataAction from './src/exportDataAction/plugin.js';

// optional runtime config
let runtimeConfig = {};

try {
const response = await fetch('./config.json', { cache: 'no-store' });

if (response.ok) {
runtimeConfig = await response.json();
} else if (response.status !== 404) {
console.warn(`Unable to load config.json: ${response.status}`);
}
} catch (error) {
console.warn('Unable to load config.json', error);
}

export default function openmctMCWSPlugin(options) {
return function install(openmct) {
const defaultConfig = {
Expand Down Expand Up @@ -156,7 +171,9 @@ export default function openmctMCWSPlugin(options) {
return item && typeof item === 'object' && !Array.isArray(item);
}

const config = deepMerge(defaultConfig, options || {});
// order of precedence: runtimeConfig, recipeConfig, defaultConfig
const recipeConfig = options || {};
const config = deepMerge(defaultConfig, deepMerge(recipeConfig, runtimeConfig));

if (config.useDeveloperStorage === undefined) {
// Attempt to define a reasonable default for developer storage that supports Open MCT build tool
Expand Down
Loading