Configu Interface Configuration File
The .configu
file is an optional configuration file used by the various Configu interfaces to customize its behavior. The file should be named .configu
regardless of the format used: JSON or YAML.
Location
Configu interfaces recursively search for the .configu
file starting from the current working directory and continuing up to the user’s home directory. Once it finds a .configu
file, it uses it solely and stops searching.
Format
The .configu
file can be written in one of the following formats: YAML
or JSON
. The file should be named .configu
regardless 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.
Properties
stores
The .configu
file allows you to save ConfigStore
configurations as friendly names, which can be later used as values for the --store
flag in all the commands.
To define a ConfigStore
, add a new key-value pair to the stores
section of the .configu
file, where the key represents the friendly name, and the value is an object with the type
and configuration
properties. The type
property represents the store type, and the configuration
property contains the specific configuration options for the store.
Additionally, you can activate the caching for a specific store by adding the cache
property to the store configuration object and set it to true
.
For detailed information about the available store options, please refer to the relevant store on the intergrations section.
cache
The .configu
file allows you to define the cache file path for the Configu CLI. The cache is used to store the results of the configu eval
command to provide failsafe and faster access to the results.
To define the cache configuration, add a new key-value pair to the .configu
file, where the key is cache
, and the value is path to the cache file.
By default, the cache file is stored in the os cache directory as follows:
- macOS:
~/Library/Caches/configu/config.sqlite
- Unix:
~/.cache/configu/config.sqlite
- Windows:
%LOCALAPPDATA%\configu\config.sqlite
schemas
The .configu
file allows you to save ConfigSchema
paths as friendly names, which can be later used as values for the --schema
flag in all the commands.
To define a custom script, add a new key-value pair to the schemas
section of the .configu
file, where the key represents the friendly name, and the value is the schema absolute or relative path.
scripts
The .configu
file allows you to save Configu CLI
snippets as friendly names, which can be later used as values for the --script
flag in the configu run --script <label>
command.
To define a custom script, add a new key-value pair to the scripts
section of the .configu
file, where the key represents the friendly name, and the value is the script content. The script content should consist of Configu CLI
commands or a pipe of commands.
The .configu
configuration file provides a way to customize the behavior of the Configu CLI. By defining custom
stores and scripts in this file, you can easily reference them in CLI commands, making it more convenient to manage
and collaborate on software configurations.
Remember that the .configu
file is optional, and if present, it will be automatically discovered by the CLI during
its recursive search process.
Example
Environment Variables
The .configu
file allows you to use environment variables in its different sections. This comes in handy for store configuration options
or scripts
when you want to avoid explicitly writing sensitive authentication credentials etc. and you want to inject them from the outside before running Configu. To use an environment variable, you can utilize mustache templating as such:
You can then pass the environment variable to the CLI using any method of setting environment variables to replace the mustache template with the environment variable value. Here is an example of passing an environment variable to the CLI by using an operating system specific prefix: