BoxLang 🚀 A New JVM Dynamic Language Learn More...
____ _____ ____ __ _ ____ _ ___
/ ___| ___/ ___|___ _ __ / _(_) __ _ / ___| | |_ _|
| | | |_ | | / _ \| '_ \| |_| |/ _` | | | | | | |
| |___| _|| |__| (_) | | | | _| | (_| | | |___| |___ | |
\____|_| \____\___/|_| |_|_| |_|\__, | \____|_____|___|
|___/
Copyright 2017 by Ortus Solutions, Corp - https://www.ortussolutions.com
This is a CommandBox module that provides a CLI for reading, writing, and storing configuration for all CF engines.
Please enter tickets for bugs or enhancements here: https://ortussolutions.atlassian.net/browse/CFCONFIG
Documentation is found here: https://cfconfig.ortusbooks.com
This does not use RDS and doesn't need the server to be running. It just needs access to the installation folder for a server to locate its config files. You will need to restart the server for the change to take effect unless you have configured the server to scan it's config files for changes.
This library is a CommandBox module that provides a CLI interface sitting on top of the cfconfig-services
project. You must use CommandBox to use this project, but the servers themselves don't need to have been started by CommandBox. You can manage the configuration of any server using this. Uses for this library include but are not limited to:
Once you have Commandbox installed run the following command to install the cfconfig
command:
box install commandbox-cfconfig
You can check to ensure you have the latest version of CFConfig like so:
box update --system
Here are some examples of commands you can run. Use the built-in help to get full details on all commands.
Each command allows you to specify a from
and/or a to
location, based on what you are doing. A location can be any one of the following:
When interacting with CommandBox servers, we try really hard to figure out the type and version of server you're dealing with. When you simply point to a folder on the hard drive that contains a server home, you'll need to tell us what format you would like the config read or written as. When writing config, the target directory doesn't need to exist. We'll create everything for you so you can import
configuration before you even start the server the first time. Proper formats look like one of these:
cfconfig export myConfig.json
cfconfig export myConfig.json serverName
cfconfig export myConfig.json /path/to/server/install/home
cfconfig import myConfig.json
cfconfig import myConfig.json serverName
cfconfig import from=myConfig.json to=/path/to/server/install/home [email protected]
Note the two servers do not need to be the same kind. CFConfig will translate the config for you.
cfconfig transfer server1 server2
cfconfig transfer from=/path/to/server1/install/home to=/path/to/server2/install/home fromFormat=adobe@11 toFormat=luceeServer@5
cfconfig show
cfconfig show from=serverName
cfconfig show from="/path/to/server/install/home"
cfconfig show requestTimeout
cfconfig show requestTimeout serverName
cfconfig show requestTimeout /path/to/server/install/home adobe@11
You can diff any two locations, meaning two servers, two JSON files, a server and a JSON file, etc, etc.
cfconfig diff server1 server2
cfconfig diff file1.json file2.json
cfconfig diff servername file.json
cfconfig diff from=path/to/servers1/home to=path/to/server2/home
You can even filter what config settings you see:
cfconfig diff to=serverName --all
cfconfig diff to=serverName --valuesDiffer --toOnly --fromOnly
Note, this command requires named parameters.
cfconfig set adminPassword=commandbox
cfconfig set adminPassword=commandbox to=serverName
cfconfig set adminPassword=commandbox to=/path/to/server/install/home toFormat=adobe@11
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.
# Pull current config from server into JSON file
cfconfig export myConfig.json
# Edit JSON file directly
cfconfig set adminPassword=commandbox to=myConfig.json
There are three commands to manage CF mappings.
cfconfig cfmapping list
cfconfig cfmapping save /foo C:/foo
cfconfig cfmapping delete /foo
There are three commands to manage datasources.
cfconfig datasource list
cfconfig datasource save myDS
cfconfig datasource delete myDS
There are three commands to manage Mail Servers.
cfconfig mailserver list
cfconfig mailserver save smtp.mail.com
cfconfig mailserver delete smtp.mail.com
There are three commands to manage Lucee caches.
cfconfig cache list
cfconfig cache save myCache
cfconfig cache delete myCache
There are three commands to manage Custom Tag Paths.
cfconfig customtagpath list
cfconfig customtagpath save /foo C:/foo/bar
cfconfig customtagpath delete /foo
There are three commands to manage Event Gateway onfig.
cfconfig eventgatewayconfig list
cfconfig eventgatewayconfig save myType "description of gateway" "java.class" 30 true
cfconfig eventgatewayconfig delete myType
There are three commands to manage Event Gatway Instances.
cfconfig eventgatewayinstance list
cfconfig eventgatewayinstance save myInstanceId CFML "/path1/some.cfc,/path2/code.cfc"
cfconfig eventgatewayinstance delete myInstanceId
There are three commands to manage Lucee Loggers.
cfconfig logger list
cfconfig logger save name=application appender=resource appenderArguments:path={lucee-config}/logs/application.log
cfconfig logger delete application
There are three commands to manage Scheduled Tasks.
cfconfig task list
cfconfig task save myTask http://www.google.com Once 4/13/2018 "5:00 PM"
cfconfig task delete myTask myGroup
If you notice a missing feature, please send a pull request or enter a ticket so we can track it.
And remember, this project is just the CLI component. If you'd like to build a custom process of managing your server's config, the entire service layer is available as a separate project, which can operate outside of CommandBox. https://www.forgebox.io/view/cfconfig-services
To run the changes you have implemnted in the config
project via commandbox you need to follow the following steps:
Uninstall your local commandbox-cfconfig
package via:
package uninstall commandbox-cfconfig --system
clone both commandbox-cfconfig
and cfconfig
services repos:
git clone [email protected]:Ortus-Solutions/cfconfig.git
git clone [email protected]:Ortus-Solutions/commandbox-cfconfig.git
run box install
inside the CFConfig services repo ONLY to get its dependencies
box
cd cfconfig
install
cd ..
box package link
the cfconfig
services repo to your commandbox core directly:
cd cfconfig
package link
box package link
the commandbox-cfconfig
to your commandbox core:
cd ..
cd commandbox-cfconfig
package link
Now I can make changes in either repo, run the reload
command and then test your changes right away.
$
box install commandbox-cfconfig