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 in conjunction with the locally stored .configu
file in the user’s home directory ($HOME/.configu/.configu
) and stops searching.
Alternatively, you may provide an explicit .configu
file by passing a path as an environment variable via CONFIGU_CONFIG
or CONFIGU_CONFIGURATION
.
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.
You can activate backup for a specific store by adding the backup
property to the store configuration object and set it to true
.
If you want to mark a ConfigStore
as your default store whenever you choose to omit a ConfigStore
as an input when performing actions with Configu’s high-level interfaces, add the default
property to a store configuration object and set it to true
. If your .configu
file only has a single store, it is automatically behaves as your default store.
For detailed information about the available store options, please refer to the relevant store on the integrations section.
backup
The .configu
file allows you to define the backup file path for the Configu CLI. The backup is used to store the results of the configu eval
command to provide failsafe and faster access to the results.
To define the backup configuration, add a new key-value pair to the .configu
file, where the key is backup
, and the value is path to the backup file.
By default, the backup 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 ConfigExpression
as such:
You can then pass the environment variable to the CLI using any method of setting environment variables to replace the ConfigExpression
with the environment variable value. Here is an example of passing an environment variable to the CLI by using an operating system specific prefix:
Was this page helpful?