Skip to main content
The configVar() function defines a standard (non-connection, non-data-source) config variable. Standard config variables hold primitive values — strings, numbers, booleans, schedules, lists, and more — that customers supply when deploying an instance. They are placed in the elements record of a configPage().

Function signature

export const configVar = <T extends StandardConfigVar>(
  definition: T,
): T

Parameters

definition
StandardConfigVar
required
An object describing the config variable. The required fields depend on the dataType chosen.

Return type

configVar
T
The same config variable definition object passed in, unchanged. The function is used for type inference.

Examples

import { configVar } from "@prismatic-io/spectral";

const apiUrl = configVar({
  stableKey: "api-url",
  dataType: "string",
  description: "Base URL of the target API.",
  defaultValue: "https://api.example.com",
});

const debugMode = configVar({
  stableKey: "debug-mode",
  dataType: "boolean",
  description: "Enable verbose logging.",
  defaultValue: false,
});