Location

.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.

Format

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 of the format used.

$schema

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.

$schema: https://json-schema.org/draft/2020-12/schema-cfgu

Properties

description
String|Markdown

Describe a ConfigKey’s purpose within the application.

type
CfguType
required

Define the data type of a ConfigValue.

  • If the type is RegEx, a pattern property must be provided.
  • If the type is JSONSchema, a schema property must be provided.
pattern
String

Define a regular expression a ConigValue must match.

  • This property must be provided if the type is RegEx.
schema
JSON Schema

Specify a JSON schema a ConigValue must conform to.

  • This property must be provided if the type is JSONSchema.
options
String[]

Specify a list of allowable ConigValues for a ConfigKey.

  • This property cannot be set together with template.
  • This property cannot be an empty array or contain empty strings.
  • Each option must be unique and according to the type of the ConfigKey.
default
String

Set a default ConfigValue for a ConfigKey if not explicitly provided.

  • This property cannot be set together with required or template or lazy properties.
  • If options is set, the default value must be one of the options.
required
Boolean

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.
depends
String[]

List other ConfigKeys this configuration depends on.

  • This property cannot be an empty array or contain reserved words.
template
String

Define a template for constructing a ConfigValue from other Configs.

  • This property cannot be set together with default or lazy.
lazy
Boolean

Indicate that a ConfigValue is set only during EvalCommand execution, excluding it from UpsertCommand assignments.

  • This property cannot be set together with default or template.
hidden
Boolean

Indicate that this ConfigKey will be omitted from ExportCommand results.

labels
String[]

List labels to categorize ConfigKeys for easier filtering on ExportCommand.

Example

$schema: https://json-schema.org/draft/2020-12/schema-cfgu
NODE_ENV:
  description: Defines the environment in which the application runs
  type: String
  options:
    - development
    - production
    - test
  default: development
LOG_LEVEL:
  description: Defines the level of logs to be recorded
  type: String
  options:
    - error
    - warn
    - info
    - verbose
    - debug
    - silly
  default: info
SERVICE_ENDPOINT:
  description: Defines the endpoint for the service
  type: URL
  required: true
AWS_REGION:
  description: Defines the AWS region for the service
  type: AWSRegion
  default: us-east-1