The Cfgu format defines the characteristics of a software configuration in Configu, providing metadata and constraints for ConfigValues. When attached to a ConfigKey in a ConfigSchema, it enables validation of ConfigValues, facilitating their implementation in the code.
.cfgu files essentially set the boundaries of different domains in the code relative to the configuration they use. Developers are free to organize and structure their .cfgu files in a way that makes sense for their specific needs and workflow. There is no limit on the number of .cfgu files that can be created, and they can be spread across different codebases, subfolders in the same project, and different repositories.
The .cfgu file can be written in one of the following formats: YAML or JSON. The name suffix of this file should be .cfgu.yaml|yml|json according to the format used.
Include the $schema property at the beginning of the file to specify the Cfgu version to communicate to other readers and tooling which specification version is intended.
Also, most modern editors will use this property to provide IntelliSense and validation for the Cfgu file.
Use this property to validate a ConfigValue. This property receives a string or an array of strings representing an
expression that evaluates to a boolean. If an array is provided, all expressions must evaluate to true for the value
to be considered valid.
An array containing all of the labels of the config. If the config has no labels, then the array will be empty. Acts
as syntax sugar for $.cfgu.label for expression consistency.
Use this to access the storedValue of another ConfigKey.
Copy
Ask AI
$schema: https://files.configu.com/schema/.cfgu.jsonkeys: NODE_ENV: description: Defines the environment in which the application runs test: expect($.value).to.be.a('string') enum: - development - production - test default: production ENABLE_FEATURE: description: Enables a feature flag. Needs be enabled in production test: - validator.isBoolean($.storedValue) - '$.configs.NODE_ENV.value === "production" ? expect($.value).to.be.true : true' default: false ENABLE_DEBUG_MODE: description: Enables a debug mode. Must not be enabled in production test: - validator.isBoolean($.storedValue) - '$.configs.NODE_ENV.value === "production" ? expect($.value).to.be.false : true' default: false
Define a constant value for a ConfigKey through a ConfigExpression, these ConfigKeys are never queried through a
ConfigStore. This property cannot be set together with lazy, default, or required.
An array containing all of the labels of the config. If the config has no labels, then the array will be empty. Acts as syntax sugar for $.cfgu.label for expression consistency.
Set a default ConfigValue for a ConfigKey if not explicitly provided.
This property cannot be set together with required, const or lazy properties.
If enum is set, the default value must be one of the options.
Indicate whether a ConfigKey is essential for the application’s functionality. When set to true, a ConfigValue
must be found on EvalCommand. This property cannot be set together with default or const.
Indicate that a ConfigValue is set only during EvalCommand execution, excluding it from UpsertCommand
assignments. This property cannot be set together with const or default.