ConfigSchema

A ConfigSchema in Configu is a file with a .cfgu.json extension. It is a human-readable, open-source format for declaring configurations and their characteristics. It is designed to be stored in your source control alongside the code that uses these configurations, and can be treated as code as it shouldn't contain sensitive data.

The ConfigSchema format provides a structured way to tie a configuration key as it appears in the code to its Cfgu properties, such as the type of data it represents (e.g., String, Number, Boolean), whether it is required or optional, and any constraints that should be applied to its value. These bindings help to ensure that configuration data is properly validated and applied, and can help to prevent misconfigurations and errors from reaching production.

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

By using .cfgu files, you can benefit from a clear and structured way to define and manage your configuration data, improving the efficiency and reliability of your software development and deployment processes, and facilitating collaboration among team members.

Example

Here is an example of a ConfigSchema (.cfgu.json) file:

{
  "API_KEY": {
    "type": "String",
    "required": true,
    "default": "abc123"
  }
}

In this example, the ConfigSchema binds a configuration called "API_KEY" with a type of "String". The configuration is marked as required and has a default value of "abc123".

Configuration key

A configuration key is the name given to a specific configuration as it appears in the code. It is used to identify and reference a specific configuration, and can be used to access the value of the configuration in the code.

Here are some examples of how a configuration key named "CONFIG" might be used as an environment variable in various programming languages:

JavaScript/TypeScript
Python
C++
Go
Rust
C#
Java
Ruby
Scala
Bash
PowerShell
1process.env.CONFIG