### Install CFConfig Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Install the CFConfig tool into CommandBox. This is the first step to using its configuration management features. ```bash CommandBox> install commandbox-cfconfig ``` -------------------------------- ### View All Configuration Settings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/set-view-settings.md Use `cfconfig show` to display all configuration settings. You can also specify a server name or installation path to view settings for a particular scope. ```bash cfconfig show ``` ```bash cfconfig show serverName ``` ```bash cfconfig show /path/to/server/install/home ``` -------------------------------- ### Install CFConfig Services Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/installation.md Use this command to install the core CFConfig services if you intend to use them directly in your project, rather than through the CLI. ```bash install cfconfig-services ``` -------------------------------- ### Basic `cfconfig diff` Examples Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/diff-settings.md Compare configuration settings between two servers, two JSON files, or a server and a JSON file. You can also specify the source and destination paths. ```bash cfconfig diff server1 server2 ``` ```bash cfconfig diff file1.json file2.json ``` ```bash cfconfig diff servername file.json ``` ```bash cfconfig diff from=path/to/servers1/home to=path/to/server2/home ``` -------------------------------- ### View Specific Configuration Setting Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/set-view-settings.md To view a particular configuration setting, provide the setting name. You can also specify a server name, installation path, or format to narrow down the search. ```bash cfconfig show requestTimeout ``` ```bash cfconfig show requestTimeout serverName ``` ```bash cfconfig show requestTimeout /path/to/server/install/home adobe@11 ``` -------------------------------- ### JSON Example with Environment Variable Substitution Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/json-file-storage.md Use `${mySetting}` to reference environment variables for dynamic values like passwords. This allows secrets to be managed outside the configuration file. ```json { "adminPassword": "${LOCAL_DEV_CF_PASS}" } ``` -------------------------------- ### Install/Update CFConfig CLI (Major/Pre-release) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/installation.md Force an installation or upgrade to a new major version or pre-release of CFConfig. Use this command when the standard update is insufficient. ```bash install commandbox-cfconfig --force ``` -------------------------------- ### Set Global JSON Expansion Replacements (Request Timeouts) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Configure global JSON expansion replacements for settings like request timeouts. This example sets default environment variable names for all settings starting with `requestTimeout`. ```bash # Use default env var name for all settings starting with "requestTimeout" and replace with ${REQUEST_TIMEOUT} and ${REQUEST_TIMEOUT_ENABLED} config set modules.commandbox-cfconfig.JSONExpansions[requestTimeout.*]= ``` -------------------------------- ### JSON Expansion Replacements (Dynamic) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/transfer-settings.md Use regular expression backreferences in environment variable names for dynamic replacements. This example creates environment variables like `DB_MYDSN_PASSWORD`. ```bash cfconfig tranfser to=.CFConfig.json replace:datasources\.(.*)\.password=DB_\1_PASSWORD ``` -------------------------------- ### List Event Gateway Configurations Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-event-gateway-configuration.md This command allows you to list all existing Event Gateway Configurations. You can optionally specify a server name or a path to the server home directory to filter the results. Use the `--JSON` flag to get the output in JSON format. ```APIDOC ## List Event Gateway Configurations ### Description Lists all Event Gateway Configurations. You can specify a server name or path to filter. ### Method `list` ### Parameters #### Query Parameters - **from** (string) - Optional - The server name or path to the server home directory. #### Flags - **--JSON** - Optional - Output the results in JSON format. ### Usage Examples ```text cfconfig eventgatewayconfig list cfconfig eventgatewayconfig list from=serverName cfconfig eventgatewayconfig list from=/path/to/server/home cfconfig eventgatewayconfig list --JSON ``` ``` -------------------------------- ### List All Scheduled Tasks Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-scheduled-tasks.md Lists all scheduled tasks. You can specify the server name or path to the server home directory. Use the --JSON flag to get output in JSON format. ```bash cfconfig task list ``` ```bash cfconfig task list from=serverName ``` ```bash cfconfig task list from=/path/to/server/home ``` ```bash cfconfig task list --JSON ``` -------------------------------- ### List all CF Mappings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-cf-mappings.md Use the `list` command to view all configured CF mappings. You can specify a server name or path to filter results. Add the `--JSON` flag to get output in JSON format. ```bash cfconfig cfmapping list ``` ```bash cfconfig cfmapping list from=serverName ``` ```bash cfconfig cfmapping list from=/path/to/server/home ``` ```bash cfconfig cfmapping list --JSON ``` -------------------------------- ### Export with Multiple JSON Expansion Replacements and Custom Dotenv File Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Perform multiple replacements and specify a custom path for the `.env` file using the `dotenvFile` parameter. This example replaces database credentials and specifies an alternative file for environment variables. ```bash cfconfig export to=.CFConfig.json replace:datasources\.(.*)\.(password|class|port|host|database)=DB_\1_\2 dotenvFile=../../settings.properties ``` -------------------------------- ### List Event Gateway Instances Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-event-gateway-instances.md Lists all Event Gateway Instances. You can specify a server name or path to the server home directory to filter the list. Use the --JSON flag to get output in JSON format. ```bash cfconfig eventgatewayinstance list ``` ```bash cfconfig eventgatewayinstance list from=serverName ``` ```bash cfconfig eventgatewayinstance list from=/path/to/server/home ``` ```bash cfconfig eventgatewayinstance list --JSON ``` -------------------------------- ### Set Web Context Admin Password Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/commandbox-server-interceptors/server-start.md Use the `cfconfig_web_xxx` naming convention to set environment variables specifically for the web context. This example sets the admin password for the web context. ```bash cfconfig_web_adminPassword=myPass ``` -------------------------------- ### Set Global JSON Expansion Replacements (Mail Server Passwords) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Configure global JSON expansion replacements using `config set` for the `commandbox-cfconfig` module. This example sets a global replacement for all mail server passwords. ```bash # Replace all mail server passwords with ${MAIL_PASSWORD} config set modules.commandbox-cfconfig.JSONExpansions[mailServers.*.password]=MAIL_PASSWORD ``` -------------------------------- ### JSON Example with Environment Variable and Default Value Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/json-file-storage.md Use `${name:default}` to provide a default value for a setting that can be overridden by an environment variable. This ensures a fallback value if the variable is not set. ```json { "requestTimeout": "${LOCAL_DEV_TIMEOUT:0,0,1,0}" } ``` -------------------------------- ### Set Environment Variables for CFConfig (Windows) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/commandbox-server-interceptors/server-start.md Use SETX to set environment variables that specify the paths to CFConfig JSON files on Windows. These variables are picked up when the server starts. ```bash C:/> SETX cfconfigfile "C:/path/to/myConfig.json" C:/> SETX cfconfigweb "C:/path/to/myConfig-web.json" C:/> SETX cfconfigserver "C:/path/to/myConfig-server.json" ``` -------------------------------- ### Export with JSON Expansion Replacements (Dynamic) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Use regex backreferences in the `replace` parameter to create dynamic environment variable names. This example creates environment variables like `DB_MYDSN_PASSWORD` where `MYDSN` is derived from the matched key. ```bash cfconfig export to=.CFConfig.json replace:datasources\.(.*)\.password=DB_\1_PASSWORD ``` -------------------------------- ### List Mail Servers Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-mail-servers.md Lists existing mail servers. You can specify a server name or path to a server home for filtering. Use the `--JSON` flag to get output in JSON format. ```bash cfconfig mailserver list ``` ```bash cfconfig mailserver list from=serverName ``` ```bash cfconfig mailserver list from==/path/to/server/home ``` ```bash cfconfig mailserver list --JSON ``` -------------------------------- ### Add or Update Event Gateway Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-event-gateway-configuration.md This command adds a new Event Gateway Configuration or updates an existing one. You need to provide the type, description, Java class, start timeout, and whether to kill on timeout. You can also specify a target server name or path. ```APIDOC ## Add or Update Event Gateway Configuration ### Description Adds or updates an Event Gateway Configuration. ### Method `save` ### Parameters #### Positional Arguments - **type** (string) - Required - The type of the event gateway. - **description** (string) - Required - A description for the gateway. - **class** (string) - Required - The Java class for the gateway. - **starttimeout** (integer) - Required - The start timeout in seconds. - **killontimeout** (boolean) - Required - Whether to kill the gateway on timeout. #### Named Arguments - **type** (string) - Required - The type of the event gateway. - **description** (string) - Optional - A description for the gateway. - **class** (string) - Required - The Java class for the gateway. - **starttimeout** (integer) - Optional - The start timeout in seconds. - **killontimeout** (boolean) - Optional - Whether to kill the gateway on timeout. - **to** (string) - Optional - The target server name or path to the server home directory. ### Usage Examples ```text cfconfig eventgatewayconfig save myType "description of gateway" "java.class" 30 true cfconfig eventgatewayconfig save type=myType description="description of gateway" class="java.class" starttimeout=30 killontimeout=true to=serverName cfconfig eventgatewayconfig save type=myType description="description of gateway" class="java.class" starttimeout=30 killontimeout=true to=/path/to/server/home ``` ``` -------------------------------- ### View All Server Settings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Run 'cfconfig show' without any arguments to display all current configuration settings for the server. ```bash CommandBox> cfconfig show ``` -------------------------------- ### Create and Write JSON Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/api-overview.md Demonstrates how to create a new JSON configuration object, set various options, and write it to a file. ```APIDOC ## Create and Write JSON Configuration ### Description Creates a new JSON configuration object, allows setting options like null support and admin password, and maps configuration paths before writing the configuration. ### Method ```javascript new path.to.JSONConfig() .setNullSupport( true ) .setUseTimeServer( true ) .setAdminPassword( 'myPass' ) .addCFMapping( '/foo', '/bar' ) .write(); ``` ``` -------------------------------- ### Update CFConfig CLI (Minor/Patch) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/installation.md Update CFConfig to the latest minor or patch version. Navigate to the CFML home directory of your CommandBox install first. ```bash update --system ``` -------------------------------- ### List Datasources Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-datasources.md Lists all datasources. You can specify the target server by name or path. ```bash cfconfig datasource list ``` ```bash cfconfig datasource list from=serverName ``` ```bash cfconfig datasource list from=/path/to/server/home ``` -------------------------------- ### View a Specific Setting Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Use the 'show' command to view the current value of a specific configuration setting, such as 'requestTimeout'. ```bash CommandBox> cfconfig show requestTimeout ``` -------------------------------- ### Import Settings with Format Specification Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/import-settings.md Import configuration specifying the source and target formats, including engine version. ```bash cfconfig import from=/path/to/.CFConfig.json to=/path/to/server/home toFormat=luceeServer@5.1 ``` -------------------------------- ### Import Settings to Server Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/import-settings.md Import configuration from a JSON file to a CommandBox server. If 'to' is not specified, it defaults to the server in the current directory. ```bash cfconfig import myConfig.json ``` ```bash cfconfig import to=serverName from=myConfig.json ``` ```bash cfconfig import to=/path/to/server/home from=myConfig.json ``` -------------------------------- ### Import Server Settings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Import server settings from a JSON file. This can be used to restore configurations or apply settings to a new server. ```bash CommandBox> cfconfig import .CFConfig.json ``` -------------------------------- ### Set Environment Variables for CFConfig (Unix) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/commandbox-server-interceptors/server-start.md Set environment variables directly in the shell to specify the paths to CFConfig JSON files on Unix-like systems. These variables are used when the server starts. ```bash $> cfconfigfile=C:/path/to/myConfig.json $> cfconfigweb=C:/path/to/myConfig-web.json $> cfconfigserver=C:/path/to/myConfig-server.json $> export cfconfigfile $> export cfconfigweb $> export cfconfigserver ``` -------------------------------- ### Import Settings with Include/Exclude Lists Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/import-settings.md Customize which configuration settings are transferred using 'includeList' and 'excludeList' parameters. Wildcards are supported for pattern matching. ```bash # Include all settings starting with "event" cfconfig import from=.CFConfig.json includeList=event* ``` ```bash # Exclude all keys called "password" regardless of what struct they are in cfconfig import from=.CFConfig.json excludeList=**.password ``` -------------------------------- ### List Event Gateway Configurations Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-event-gateway-configuration.md Use these commands to list all Event Gateway configurations. You can specify a server name or path to a server home directory to filter the results. ```text cfconfig eventgatewayconfig list ``` ```text cfconfig eventgatewayconfig list from=serverName ``` ```text cfconfig eventgatewayconfig list from=/path/to/server/home ``` -------------------------------- ### Override Nested Setting with Underscores Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/env-var-overrides.md For nested settings within structs or arrays, use underscores to represent dots in the environment variable name. This example overrides the password for a datasource named `myDSN`. ```bash cfconfig_datasources_myDSN_password=myPass ``` -------------------------------- ### List Event Gateway Configurations as JSON Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-event-gateway-configuration.md Append the `--JSON` flag to the list command to receive the output in JSON format. ```text cfconfig eventgatewayconfig list --JSON ``` -------------------------------- ### List Datasources as JSON Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-datasources.md Lists all datasources and outputs the data in JSON format using the `--JSON` flag. ```bash cfconfig datasource list --JSON ``` -------------------------------- ### Read JSON Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/api-overview.md Shows how to read an existing JSON configuration file. ```APIDOC ## Read JSON Configuration ### Description Reads an existing JSON configuration file from the specified path. ### Method ```javascript new path.to.JSONConfig() .read( 'test.json' ); ``` ``` -------------------------------- ### Basic Transfer Commands Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/transfer-settings.md Specify source and destination servers or paths for configuration transfer. If no `from` or `to` is provided, it defaults to the current CommandBox server. ```bash cfconfig transfer from=servername to=anotherServername ``` ```bash cfconfig transfer from=serverName ``` ```bash cfconfig transfer to=serverName ``` ```bash cfconfig transfer from=/path/to/server/home to=/path/to/another/server/home ``` ```bash cfconfig transfer from=/path/to/server/home ``` ```bash cfconfig transfer to=/path/to/server/home ``` -------------------------------- ### Export Configuration to JSON Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Export configuration to a JSON file. If `to` is not specified, it defaults to a file named `myConfig.json` in the current directory. If no server is specified with `from`, it looks for a CommandBox server in the current working directory. ```bash cfconfig export myConfig.json ``` ```bash cfconfig export from=serverNameToExportFrom to=myconfig.json ``` ```bash cfconfig export from=/path/to/server/home to=myconfig.json ``` -------------------------------- ### Import Settings with Append Flag Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/import-settings.md Use the 'append' parameter to merge incoming configuration data with existing settings on the server, preventing the removal of pre-existing configurations. ```bash cfconfig import from=.CFConfig.json includeList=datasources --append ``` -------------------------------- ### Create New JSON Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/api-overview.md Use this to create a new JSON configuration file programmatically. Supports setting null support, time server, admin password, and custom mappings. ```javascript JSONConfig = new path.to.JSONConfig() .setNullSupport( true ) .setUseTimeServer( true ) .setAdminPassword( 'myPass' ) .addCFMapping( '/foo', '/bar' ) .write(); ``` -------------------------------- ### Diff Settings Between Servers Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Compare configuration settings between two servers. Options allow filtering to show only differences, or settings unique to one server. ```bash CommandBox> cfconfig diff from=oneServer to=anotherServer ``` ```bash CommandBox> cfconfig diff to=anotherServerName ``` ```bash CommandBox> cfconfig diff to=anotherServerName --fromOnly ``` ```bash CommandBox> cfconfig diff to=anotherServerName --toOnly ``` ```bash CommandBox> cfconfig diff to=anotherServerName --valuesDiffer ``` -------------------------------- ### Set Global JSON Expansion Replacements (Dynamic Database Credentials) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Configure global JSON expansion replacements for dynamic database credentials. This allows for consistent environment variable naming across different datasources. ```bash # Dynamically replace with ${DB_MYDSN_password}, ${DB_MYDSN_CLASS}, ${DB_MYDSN_PORT}, etc config set modules.commandbox-cfconfig.JSONExpansions[datasources\.(.*)\.(password|class|port|host|database)]=DB_\1_\2 ``` -------------------------------- ### Manage Datasources Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Commands to save, list, and delete datasource configurations for your CF server. ```bash CommandBox> cfconfig datasource save name=myDSN dbdriver=mysql host=localhost port=3306 database=myDB username=brad password=foobar ``` ```bash CommandBox> cfconfig datasource list ``` ```bash CommandBox> cfconfig datasource delete myDSN ``` -------------------------------- ### Export Server Settings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Export all current server settings to a JSON file. This is useful for backups or migrating configurations. ```bash CommandBox> cfconfig export .CFConfig.json ``` -------------------------------- ### Transfer Settings Between Servers Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Transfer configuration settings from one server to another by specifying the source and destination server names. ```bash CommandBox> cfconfig transfer from=oneServer to=anotherServer ``` -------------------------------- ### JSON Expansion Replacements (Multiple Keys) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/transfer-settings.md Perform multiple replacements for various configuration keys, creating dynamic environment variables. The `dotenvFile` parameter can override the output path for environment variables. ```bash cfconfig tranfser to=.CFConfig.json replace:datasources\.(.*)\.(password|class|port|host|database)=DB_\1_\2 dotenvFile=../../settings.properties ``` -------------------------------- ### Export with Lucee Web Context Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Export configuration, defaulting to the server context. Use `fromFormat=luceeWeb` to switch to a Lucee web context. ```bash cfconfig export to=myConfig.json fromFormat=luceeWeb ``` -------------------------------- ### Export with Include and Exclude Lists Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Customize exported settings using `includeList` and `excludeList` parameters. `includeList` accepts patterns to include only matching settings, while `excludeList` accepts patterns to exclude specific keys. Wildcards like `*` and `**` are supported for pattern matching. ```bash # Include all settings starting with "event" cfconfig export to=.CFConfig.json includeList=event* ``` ```bash # Exclude all keys called "password" regardless of what struct they are in cfconfig export to=.CFConfig.json excludeList=**.password ``` -------------------------------- ### Show Configuration for Lucee Web Context Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md This command shows the configuration for the Lucee web context. It assumes you are running CFConfig from the web root of an embedded server. ```bash cfconfig show fromFormat=luceeWeb ``` -------------------------------- ### Include and Exclude Settings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/transfer-settings.md Customize which settings are transferred using `includeList` and `excludeList` parameters. Wildcards are supported. ```bash cfconfig transfer from=.CFConfig.json includeList=event* ``` ```bash cfconfig transfer from=.CFConfig.json excludeList=**.password ``` -------------------------------- ### Export with Specific Format and Version Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Export configuration specifying the source format and version. The version number can be omitted for `toFormat` and `fromFormat` when working with CFConfig JSON files or CommandBox servers. ```bash cfconfig export to=/path/to/.CFConfig.json from=serverNameToExportFrom fromFormat=luceeServer@5.1 ``` -------------------------------- ### Save (Create/Update) Cache Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-caches.md Saves a new cache or updates an existing one. Caches are matched by name. You can specify the cache type by name or full Java class. Target a specific server using `to=serverName` or `to=/path/to/server/home`. Custom properties can be passed prefixed with `custom:`. ```bash cfconfig cache save myCache RAM ``` ```bash cfconfig cache save name=myOtherCache type=EHCache ``` ```bash cfconfig cache save name=myCache type=EHCache to=serverName ``` ```bash cfconfig cache save name=myCache type=RAM to=/path/to/server/home ``` ```bash cfconfig cache save myCache lucee.runtime.cache.ram.RamCache ``` ```bash cfconfig cache save name=myCache class=lucee.runtime.cache.ram.RamCache to=serverName ``` ```bash cfconfig cache save name=myCache class=lucee.runtime.cache.ram.RamCache to=/path/to/server/home ``` ```bash cfconfig cache save name=myCache type=RAM custom:timeToIdleSeconds=0 custom:timeToLiveSeconds=0 ``` -------------------------------- ### Save Datasource Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-datasources.md Adds a new datasource or updates an existing one. Datasources are matched by name. Specify the target server by name or path. ```bash cfconfig datasource save name=myDSN dbdriver=mysql host=localhost port=3306 database=myDB username=brad password=foobar ``` ```bash cfconfig datasource save name=myDS ... to=serverName ``` ```bash cfconfig datasource save name=myDS ... to=/path/to/server/home ``` -------------------------------- ### Global JSON Expansion Settings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/transfer-settings.md Configure global JSON expansion replacements for the `commandbox-cfconfig` module using `config set`. This avoids passing replacement mappings with every transfer command. ```bash # Replace all mail server passwords with ${MAIL_PASSWORD} config set modules.commandbox-cfconfig.JSONExpansions[mailServers.*.password]=MAIL_PASSWORD ``` ```bash # Dynamically replace with ${DB_MYDSN_password}, ${DB_MYDSN_CLASS}, ${DB_MYDSN_PORT}, etc config set modules.commandbox-cfconfig.JSONExpansions[datasources\.(.*)\.(password|class|port|host|database)]=DB_\1_\2 ``` ```bash # Use default env var name for all settings starting with "requestTimeout" and replace with ${REQUEST_TIMEOUT} and ${REQUEST_TIMEOUT_ENABLED} config set modules.commandbox-cfconfig.JSONExpansions[requestTimeout.*]= ``` -------------------------------- ### Generating PDF Diff Reports Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/diff-settings.md Export the configuration differences to a PDF report. Specify the output directory or a full file path. The report content mirrors the CLI output, respecting any applied filters. ```bash cfconfig diff to=... from=... PDFReportPath=folder/ ``` ```bash cfconfig diff to=... from=... PDFReportPath=folder/file.pdf ``` -------------------------------- ### Set Admin Password on Windows Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/commandbox-server-interceptors/server-start.md Use the SETX command to set the `cfconfig_adminPassword` environment variable on Windows. This password will be loaded on server startup. ```bash C:/> SETX cfconfig_adminPassword "myCoolPass123" ``` -------------------------------- ### Generating HTML Diff Reports Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/diff-settings.md Export the configuration differences to an HTML report. Specify the output directory or a full file path. The report content mirrors the CLI output, respecting any applied filters. ```bash cfconfig diff to=... from=... HTMLReportPath=folder/ ``` ```bash cfconfig diff to=... from=... HTMLReportPath=folder/file.html ``` -------------------------------- ### Read Lucee 4 Server Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/api-overview.md Demonstrates reading a Lucee 4 server configuration file and accessing its memento. ```APIDOC ## Read Lucee 4 Server Configuration ### Description Reads an existing Lucee 4 server configuration file. Requires setting the ColdFusion home path. ### Method ```javascript new path.to.Lucee4ServerConfig() .setCFHomePath( expandPath( '/path/to/lucee-server' ) ) .read(); writeDump( lucee4ServerConfig.getMemento() ); ``` ``` -------------------------------- ### Set a Specific Setting Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Use the 'set' command to update a configuration setting. Values can be comma-separated for settings that accept multiple parts. ```bash CommandBox> cfconfig set requestTimeout=0,0,10,0 ``` -------------------------------- ### Transfer with Format Specification Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/transfer-settings.md Transfer configuration, specifying the source and destination formats, including engine version. ```bash cfconfig transfer from=/path/to/.CFConfig.json to=/path/to/server/home toFormat=luceeServer@5.1 ``` -------------------------------- ### Export Adobe CF Home Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md Use this command to export configuration from an Adobe ColdFusion home directory. Specify the cfusion path and destination. ```bash cfconfig export from=C:/ColdFusion2025/cfusion/ to=myconfig.json ``` -------------------------------- ### Export Lucee 4/5 Web Context Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md Use this command to export configuration from a Lucee 4/5 web context. Specify the web root and destination path. ```bash cfconfig export from=C:/myapp/WEB-INF/lucee/ to=myconfig.json ``` -------------------------------- ### Import Settings to Lucee Web Context Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/import-settings.md Import configuration and explicitly set the target context to Lucee web. The version number can be omitted when working with CFConfig JSON files or CommandBox servers. ```bash cfconfig import from=myConfig.json toFormat=luceeWeb ``` -------------------------------- ### Read Existing JSON Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/api-overview.md Reads an existing JSON configuration file from the specified path. Ensure the file exists. ```javascript JSONConfig = new path.to.JSONConfig() .read( 'test.json' ); ``` -------------------------------- ### Enable Server Stop Export Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/commandbox-server-interceptors/server-stop.md Add this global config setting to enable exporting CF settings to JSON upon server stop. The setting defaults to off and requires explicit opt-in. ```bash config set modules.commandbox-cfconfig.exportOnStop=true ``` -------------------------------- ### Manage CF Mappings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/getting-started-guide.md Commands to save, list, and delete virtual-to-physical path mappings for your CF server. ```bash CommandBox> cfconfig cfmapping save virtual=/foo physical=C:/bar ``` ```bash CommandBox> cfconfig cfmapping list ``` ```bash CommandBox> cfconfig cfmapping delete /foo ``` -------------------------------- ### Import Configuration for Lucee Web Context Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md Import a configuration file into the Lucee web context. This assumes you are running CFConfig from the web root of an embedded server. ```bash cfconfig import from=config_admin.json toFormat=luceeWeb ``` -------------------------------- ### Targeting Server or Web Contexts Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/env-var-overrides.md Specify whether an environment variable override targets the server context or the web context. The default is server context. For Adobe ColdFusion, these are loaded normally. ```bash # Default (server context) cfconfig_requestTimeout=... # Force web context. (On adobe, just loaded normally) cfconfig_web_requestTimeout=... # Force server context- same as default. (On adobe, just loaded normally) cfconfig_server_requestTimeout=... ``` -------------------------------- ### List Existing Caches Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-caches.md Lists existing caches for a Lucee server. Specify the context or target a specific server by name or path. Use `--JSON` for JSON output. ```bash cfconfig cache list ``` ```bash cfconfig cache list fromFormat=luceeWeb ``` ```bash cfconfig cache list from=serverName ``` ```bash cfconfig cache list from=/path/to/server/home ``` ```bash cfconfig cache list --JSON ``` -------------------------------- ### CFConfig Null Support and Dot Notation Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/config-items.md Configures null support and the behavior of dot notation case sensitivity. ```javascript // true/false name='nullSupport' type='boolean' ``` ```javascript // true/false name='dotNotationUpperCase' type='boolean' ``` -------------------------------- ### CFConfig Locale and Time Settings Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/the-basics/config-items.md Sets the locale, time zone, and NTP server for time synchronization. ```javascript // Ex: en_US name='thisLocale' type='string' ``` ```javascript // Ex: America/Chicago name='thisTimeZone' type='string' ``` ```javascript // Ex: pool.ntp.org name='timeServer' type='string' ``` ```javascript // true/false name='useTimeServer' type='boolean' ``` -------------------------------- ### CFConfig Public Methods Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/usage.md All CFConfig components, including engine-specific mappers and BaseConfig, expose the following public methods for interacting with configuration files. ```APIDOC ## setCFHomePath() ### Description Sets the directory path where configuration files are located or will be written. ### Method `setCFHomePath()` ### Parameters #### Path Parameters - **CFHomePath** (string) - Required - The absolute path to the server home directory. ``` ```APIDOC ## read( CFHomePath ) ### Description Reads the configuration from the files found in the specified server home directory. ### Method `read( CFHomePath )` ### Parameters #### Path Parameters - **CFHomePath** (string) - Optional - Overrides the default server home path for reading configuration. ``` ```APIDOC ## write( CFHomePath ) ### Description Writes the current configuration to the files in the specified server home directory, creating them if they do not exist. ### Method `write( CFHomePath )` ### Parameters #### Path Parameters - **CFHomePath** (string) - Optional - Overrides the default server home path for writing configuration. ``` ```APIDOC ## getMemento() ### Description Returns the entire configuration as a raw CFML data structure. This is useful for transferring configuration data between instances. ### Method `getMemento()` ### Parameters None ``` ```APIDOC ## setMemento( mementoData ) ### Description Accepts configuration data in the form of a raw CFML data structure. This is useful for setting configuration values from another instance's memento. ### Method `setMemento( mementoData )` ### Parameters #### Request Body - **mementoData** (struct) - Required - A CFML data structure representing the configuration. ``` -------------------------------- ### Export Lucee 6/7 Server Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md Use this command to export configuration from a Lucee 6/7 server home. Specify the source and destination paths. ```bash cfconfig export from=C:/lucee/tomcat/lucee-server/ fromFormat=luceeServer to=myconfig.json ``` -------------------------------- ### Export Lucee 4/5 Server Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md Use this command to export configuration from a Lucee 4/5 server home. Specify the source and destination paths. ```bash cfconfig export from=C:/lucee/tomcat/lucee-server/ to=myconfig.json ``` -------------------------------- ### Add or Update Event Gateway Configuration Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-event-gateway-configuration.md These commands add or update an Event Gateway configuration. You can provide parameters positionally or using named arguments, and specify the target server by name or path. ```text cfconfig eventgatewayconfig save myType "description of gateway" "java.class" 30 true ``` ```text cfconfig eventgatewayconfig save type=myType description="description of gateway" class="java.class" starttimeout=30 killontimeout=true to=serverName ``` ```text cfconfig eventgatewayconfig save type=myType description="description of gateway" class="java.class" starttimeout=30 killontimeout=true to=/path/to/server/home ``` -------------------------------- ### Export with JSON Expansion Replacements (Single) Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/export-settings.md Automatically replace sensitive information in the exported JSON with environment variable expansions. The `replace` parameter takes a regex to match a key and the environment variable name. A `.env` file is created by default. ```bash cfconfig export to=.CFConfig.json replace:datasources\.myDSN\.password=DB_PASSWORD ``` -------------------------------- ### Configure CFConfig Import in server.json Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/commandbox-server-interceptors/server-start.md Specify paths to JSON configuration files within the 'cfconfig' property of your server.json file. This allows for centralized configuration management. ```json "cfconfig" : { // Single JSON file to import into Adobe or the Lucee server context "file" : "path/to/file.json", // Same as "file" but for consistency with Lucee "server" : "path/to/file.json", // Will load into lucee/railo web context "web" : "path/to/file.json", // Import scheduled tasks as paused "pauseTasks" : true }, // Backwards compat fallback "CFConfigFile" : "path/to/file.json" "CFConfigPauseTasks": true ``` -------------------------------- ### Using Deep Property Names with cfconfig Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/set-view-settings.md The `cfconfig set` and `cfconfig show` commands support 'deep' property names to access and modify nested configuration properties, similar to `package set/show`. ```bash cfconfig show datasources.myDSN ``` ```bash cfconfig show mailServers[1].port ``` ```bash cfconfig set loggers.deploy.level=debug ``` ```bash cfconfig set datasources.myDSN.password=myPass ``` -------------------------------- ### Read JSON and Write to Lucee 4 Web Context Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-services/api-overview.md Illustrates reading a JSON configuration and applying it to a Lucee 4 web context. ```APIDOC ## Read JSON and Write to Lucee 4 Web Context ### Description Reads a JSON configuration file and then writes it to a specified Lucee 4 web context directory. ### Method ```javascript new path.to.JSONConfig() .read( expandPath( '.CFConfig.json' ) ); new path.to.Lucee4WebConfig() .setMemento( JSONConfig.getMemento() ) .write( expandPath( 'WEB-INF/lucee/' ) ); ``` ``` -------------------------------- ### List All Lucee Loggers Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/manage-lucee-loggers.md Use this command to list all configured loggers on the Lucee server. You can specify a server name or path to a server home to target a specific instance. ```bash cfconfig logger list ``` ```bash cfconfig logger list from=serverName ``` ```bash cfconfig logger list from=/path/to/server/home ``` -------------------------------- ### Specify JSON File Path Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md Provide the direct path to a JSON configuration file. CFConfig auto-detects JSON files by their extension. ```bash C:/path/to/myConfig.json ``` -------------------------------- ### Append Mode for Merging Data Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/transfer-settings.md Use the `append` parameter to merge incoming configuration data with existing settings, preventing the removal of pre-existing items. ```bash cfconfig transfer from=.CFConfig.json includeList=datasources --append ``` -------------------------------- ### Override a Simple Setting with Env Var Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/env-var-overrides.md Set a simple configuration value like `adminPassword` by prefixing the setting name with `cfconfig_` in your environment variables. ```bash cfconfig_adminPassword=myPass ``` -------------------------------- ### Set Configuration Setting Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/command-overview/set-view-settings.md Use `cfconfig set` with named parameters to set a configuration value. You can specify the target scope using `to=` and format using `toFormat=`. ```bash cfconfig set adminPassword=commandbox ``` ```bash cfconfig set adminPassword=commandbox to=serverName ``` ```bash cfconfig set adminPassword=commandbox to=/path/to/server/install/home toFormat=adobe@11 ``` -------------------------------- ### Export Specific Lucee Web Contexts Source: https://github.com/ortus-docs/cfconfig-docs/blob/master/using-the-cli/usage.md Export configurations for specific Lucee web contexts by specifying the web root in the format name. This is useful when ModCFML is used. ```bash cfconfig export fromFormat=luceeWeb-/path/to/webroot/site1 to=.cfconfig-web-site1.json ``` ```bash cfconfig export fromFormat=luceeWeb-/path/to/webroot/site2 to=.cfconfig-web-site2.json ```