Parameters in c4
This section provides an overview of how configuration parameters in c4 are structured and defined.
Parameter Structure
The c4 deployment tool has a large number of configurable parameters. The majority of these parameters can be left at their default values for most deployment scenarios, and many apply only to a specific deployment platform. Some parameters must however be set in order to create a deployment.
You can set configuration values persistently using local configuration files, and/or specifically for each deployment by setting parameters on the command line. For more details, see Parameters in c4.
The parameters are organized into modules that indicate in which context they are applied, such as USER or PLAY. The parameter names start with CCC_<MODULE>_
. For example:
Parameter | Description |
---|---|
CCC_USER_EMAIL
|
Email address to be used for deployment tagging |
CCC_PLAY_ACCESS_NODE
|
Boolean for including an access node in the deployment. If this option is unset or set to false an access node will not be deployed. |
The full list of available parameters in c4 can be viewed using the command c4 config -F
.
To learn more about specific parameters, use c4 config -K <string>
, where <string
> is the full or partial name of a parameter. The value is case-insensitive. For example, to get a description of all parameters in the CCC_PLAY
module, use c4 config -K ccc_play
. To get all parameters that contain “PASSWORD
” in their names, use c4 config -K password
.
To learn more about how to use the config
command, use c4 config --help
.
Parameter Setting
Configuration parameters can be specified in configuration files using shell, JSON, or YAML format, on the command line as environment variables before the command, and as command-line options.
Options on the command line can be absolute or relative. An absolute option can be specified anywhere in the command. A relative option must be preceded by the module name. The module name can be followed by multiple (relative) options, see examples below.
Parameter values are loaded from the different locations in the following order:
- User configuration file
- Configuration file loaded on the command line
- Environment variables
- Command-line parameters
For example, a parameter value set in an environment variable will override the value for the same parameter specified in a configuration file, but will be overridden by a value set on the command line.
Parameter Formats
Parameters must be formatted differently depending on where they are specified:
Location | Format | Example |
---|---|---|
Shell config file | Use the full parameter name in UPPERCASE. | CCC_PLAY_DATABASE_NAME=my_db
|
JSON or YAML config file |
Exclude the Must be placed in a subsection for the corresponding module. |
play: |
Environment variable | Use the full parameter name in UPPERCASE. | CCC_PLAY_DATABASE_NAME=my_db
|
Command-line option (absolute) |
Replace |
c4 play --ccc-play-database-name my_db ...
|
Command-line option (relative) |
Exclude the Must be preceded by the module name. |
c4 play --database-name my_db --db-password j8IUgef7_IJz9 ...
|
Parameter Data Types
Each parameter has a defined data type that it accepts for the value. The type is automatically validated when a parameter value is changed. The available types are:
Type | Format | Example |
---|---|---|
string | Can contain text or numbers. If the string contains spaces, it must be enclosed in quotation marks. |
|
int | Number (integer) | CCC_PLAY_DB_PORT=8563
|
bool | true or false |
CCC_PLAY_ACCESS_NODE=true
|
list |
A list of strings. When specified in environment variables, list values must be entered as space-separated strings. Values that contain spaces must be enclosed in quotation marks. When defined on the command line, list values must be specified by repeating the parameter name for each element. |
Examples
-
User configuration file
The user configuration file is located in
$HOME/.ccc
and can use shell, YAML, or JSON format. The default filename is config.-
$HOME/.ccc/config
-
$HOME/.ccc/config.yaml
-
$HOME/.ccc/config.json
Example of a configuration file in shell format:
$ cat $HOME/.ccc/config
CCC_USER_EMAIL=firstname.lastname@exasol.com
CCC_HOST_EXTERNAL_ADDRS="198.51.100.11 198.51.100.12 198.51.100.13"
CCC_HOST_DATADISK=/dev/mapper/exasol_disk_1,/dev/mapper/exasol_disk_2
CCC_PLAY_WORKING_COPY=@exasol-8.22.0To update the configuration file, open the file using a text editor and add a new line using the one of the supported formats. Afterwards, save the file. The configuration is updated immediately.
To confirm that the configuration is valid, use
c4 config --validate
.The parameter values specified in the user configuration file will be used by default in every c4 statement, unless another value is specified in one of the locations specified below.
-
-
Command configuration file
You can define parameters in a file in shell, YAML, or JSON format and load this file into c4 using
CCC_CONFIG
on the command line. The parameter values specified in this file will override the default values and values set in the user configuration file.Parameters for a specific module must be added within a corresponding subsection of the file. For example, the following YAML file specifies the database name and password:
When running a command, specify
CCC_CONFIG
and the name of the configuration file. For example: -
Command-line parameters
Parameter values can be specified on the command line as part of a c4 command. This is useful if you want to specify parameters that are only used for one command and should not be persisted.
Relative parameters for a specific module must be added immediately after the module name in the command. For example, when creating a deployment, you can specify the database name (
--database-name
) and the database password. These parameters--database-name
are a configuration of the PLAY module, and must therefore be preceded by theplay
command:Alternatively, you can reference the absolute parameter names and list them anywhere in the c4 command. For example: