Here's an overview of all the commands available to the CFConfig CLI. There are sub-pages for each of these commands with additional details.
cfconfig export
Extracts all configuration from a server to a location of your choice.
cfconfig import
Imports all configuration from a location of your choice into a server. Like export
, but spelled different.
cfconfig transfer
Moves all configuration from a location of your choice to another location of your choice. Like import
and export
but pronounced different.
cfconfig diff
Shows a diff of every setting that's different between two servers or a server and a JSON file.
cfconfig set
Sets or overwrites a single setting on a server.
cfconfig show
Views a single setting on a server.
cfconfig datasource list
List all datasources.
cfconfig datasource save
Add or update a datasource by name
cfconfig datasource delete
Remove a datasource by name.
cfconfig cfmapping list
List all CF mappings
cfconfig cfmapping save
Add or update a CF mapping by virtual path.
cfconfig cfmapping delete
Remove a CF mapping by virtual path.
cfconfig cache list
List all caches in a Lucee/Railo server.
cfconfig cache save
Add or update a cache by name.
cfconfig cache delete
Remove a cache by name.
cfconfig mailserver list
List all mail servers on a server.
cfconfig mailserver save
Add or update a mail server by host.
cfconfig mailserver delete
Delete a mail server by host.
cfconfig customtagpath list
List all Custom Tag paths
cfconfig customtagpath save
Save a Custom Tag path
cfconfig customtagpath delete
Delete a Custom Tag path
cfconfig eventgatewayconfig list
List all Event Gateway Configurations
cfconfig eventgatewayconfig save
Add or update an Event Gateway Configuration
cfconfig eventgatewayconfig delete
Delete an Event Gateway Configuration
cfconfig eventgatewayinstance list
List all Event Gateway Instances
cfconfig eventgatewayinstance save
Add or update an Event Gateway Instance
cfconfig eventgatewayinstance delete
Delete an Event Gateway Instance
cfconfig logger list
List all Lucee Loggers
cfconfig logger save
Add or update a Lucee Logger
cfconfig logger delete
Delete a Lucee Logger
cfconfig task list
List all Scheduled Tasks
cfconfig task save
Add or update a Scheduled Task
cfconfig task delete
Delete a Scheduled Task
Export configuration from a server. If you don't specify a to
, we look for a CommandBox server using the current working directory. Only rely on this if you have a single CommandBox server running in the current directory.
All the same rules for engine format and version apply.
The version number can be left off toFormat
and fromFormat
when reading or writing to a CFConfig JSON file or a CommandBox server since we already know the version. If you don't specify a Lucee web or Server context, we default to server. Use a format of "luceeWeb" to switch.
In some situations you might need to alter the data being imported such as with Scheduled Tasks that you might not want to run on the target server. Adding the --pauseTasks
flag will import the scheduled tasks in the paused state.
You can customize what config settings are transferred with the includeList
and excludeList
params. If at least one include pattern is provided, only matching settings will be included. Nested keys such as datasources.myDSN
or mailservers[1]
can be used. You may also use basic wildcards in your pattern. A single *
will match any number of chars inside a key name. A double **
will match any number of nested keys.
Use the append
parameter to merge incoming data with any data already present. For example, if a server already has one datasource defined, and you import a JSON file with 2 more unique datasources, the --append
flag will not remove the pre-existing one.
If you usually replace sensitive or volatile information in a JSON export with env var expansions like ${DB_PASSWORD},
you can do this automatically my supplying one or more replace mappings. The key is a regular expression to match a key in the format of datasources.myDSN.password
and the value is the name of the env var to use. The values will be written to a .env
file in the current working directory. You can override this path with the dotenvFile
param, or pass an empty string to disable it from being written.
As the value is a regular expression, you can use backreferences like \1
in your env var to make them dynamic.
This example would create env vars such as DB_MYDSN_PASSWORD
where MYDSN
is your actual datasource name.
Any valid regex is possible for some clever replacements. This example would create env vars such as DB_MYDSN_PORT
, DB_MYDSN_HOST
, and DB_MDSN_DATABASE
To avoid having to pass these replacements every time you transfer your config, you can set then as a global setting for the commandbox-cfconfig
module.
Import configuration to a server. If you don't specify a to
, we look for a CommandBox server using the current working directory. Only rely on this if you have a single CommandBox server running in the current directory.
All the same rules for engine format and version apply.
The version number can be left off toFormat
and fromFormat
when reading or writing to a CFConfig JSON file or a CommandBox server since we already know the version. If you don't specify a Lucee web or Server context, we default to server. Use a format of luceeWeb
to switch.
You can customize what config settings are transferred with the includeList
and excludeList
params. If at least one include pattern is provided, only matching settings will be included. Nested keys such as datasources.myDSN
or mailservers[1]
can be used. You may also use basic wildcards in your pattern. A single *
will match any number of chars inside a key name. A double **
will match any number of nested keys.
Use the append
parameter to merge incoming data with any data already present. For example, if a server already has one datasource defined, and you import a JSON file with 2 more unique datasources, the --append
flag will not remove the pre-existing one.
Transfer configuration from one location/server to another. If you don't specify a from or to, we look for a CommandBox server using the current working directory. Only rely on this if you have a single CommandBox server running in the current directory. You must specify at least a from
or a to
.
Note the two servers do not need to be the same kind. CFConfig will translate the config for you.
All the same rules for engine format and version apply.
The version number can be left off toFormat
and fromFormat
when reading or writing to a CFConfig JSON file or a CommandBox server since we already know the version. If you don't specify a Lucee web or Server context, we default to server. Use a format of luceeWeb
to switch.
You can customize what config settings are transferred with the includeList
and excludeList
params. If at least one include pattern is provided, only matching settings will be included. Nested keys such as datasources.myDSN
or mailservers[1]
can be used. You may also use basic wildcards in your pattern. A single *
will match any number of chars inside a key name. A double **
will match any number of nested keys.
Use the append
parameter to merge incoming data with any data already present. For example, if a server already has one datasource defined, and you import a JSON file with 2 more unique datasources, the --append
flag will not remove the pre-existing one.
If you usually replace sensitive or volatile information in a JSON export with env var expansions like ${DB_PASSWORD},
you can do this automatically my supplying one or more replace mappings. The key is a regular expression to match a key in the format of datasources.myDSN.password
and the value is the name of the env var to use. The values will be written to a .env
file in the current working directory. You can override this path with the dotenvFile
param, or pass an empty string to disable it from being written.
As the value is a regular expression, you can use backreferences like \1
in your env var to make them dynamic.
This example would create env vars such as DB_MYDSN_PASSWORD
where MYDSN
is your actual datasource name.
Any valid regex is possible for some clever replacements. This example would create env vars such as DB_MYDSN_PORT
, DB_MYDSN_HOST
, and DB_MDSN_DATABASE
To avoid having to pass these replacements every time you transfer your config, you can set then as a global setting for the commandbox-cfconfig
module.
You can diff any two locations, meaning two servers, two JSON files, a server and a JSON file, etc.
You can even filter what config settings you see:
The cfconfig diff
commandbox has the ability to export HTML and PDF files. The contents of the report will exactly match what displays in the CLI. So any flags you apply such as --toOnly
will also filter the report output. This can be handy for historical purposes or just to get the data into a format that's easier to read than the CLI.
To generate an HTML report:
To generate a PDF report:
You can generate both HTML and PDF at the same time if you like. If you don't provide a filename, one is created for you with the following format:
The report directory is also created for you if it doesn't exist.
Remember, you can get funky and generate clever report names on the fly such as:
This would give you a name like Daily-Report-Thursday.pdf
! Existing files are overwritten.
Note, this command requires named parameters.
You can actually use CFConfig set to manage the static contents of a JSON export. The JSON file is, after all, just another location you can read from or write to.
The cfconfig set
and cfconfig show
commands work the same as package set/show
in that you can use "deep" keys to access nested properties.
Keep in mind that examples such as the last line above can create invalid config if you don't already have a datasource called myDSN
. If you're needing to create new complex objects, or you're not sure if they will exist, use the other CFConfig namespaces like cfconfig datasource save
which will ensure complete settings are saved.
There are three commands to manage datasources.
To receive the data back as JSON, use the --JSON
flag.
Add a new datasource or update an existing datasource. Existing datasources will be matched based on the name. Valid dbdriver options are
MSSQL -- SQL Server driver
MSSQL2 -- jTDS driver
PostgreSql
Oracle
Other -- Custom JDBC URL
MySQL
Identify the datasource uniquely by the name.
There are three commands to manage CF mappings.
To receive the data back as JSON, use the --JSON
flag.
Add a new CF mapping or update an existing CF Mapping. Existing mappings will be matched based on the virtual path.
Identify the mapping uniquely by the virtual path.
There are three commands to manage Lucee/Railo caches.
To receive the data back as JSON, use the --JSON
flag.
Add a new cache or update an existing cache. Existing caches will be matched based on the name. You can use a the type
parameter as a shortcut for specifying the full Java class, which may change between versions.
Alternatively, specify the full class name.
If your cache provider expects custom properties, pass them as additional parameters to this command prefixed with the text custom:
. This requires named parameters, of course.
Identify the cache uniquely by the name.
There are three commands to manage Mail Servers.
To receive the data back as JSON, use the --JSON
flag.
Add a new mail server or update an existing mail server. Existing mail servers will be matched based on the host name.
Identify the mail server uniquely by the host name.
Event Gateway Configurations are currently only supported for Adobe ColdFusion. Please contact us if you'd like to sponsor this feature.
To receive the data back as JSON, use the --JSON
flag.
Scheduled tasks are supported for both Lucee Server and Adobe ColdFusion. Both engines have some features which are not supported by the other. Check the parameter descriptions in the command help for cfconfig task save
for more info.
All CFConfig commands when run against a Lucee server will default to the fromFormat
or toFormat
to luceeServer
. These commands are a notable exception-- since scheduled tasks can only be imported into a Lucee web context, all commands in the cfconfig task
namespace will default to the luceeWeb
for Lucee servers.
To receive the data back as JSON, use the --JSON
flag.