Blog

Brad Wood

March 07, 2017

Spread the word


Share your thoughts

We're very excited to unveil a brand new project we've been working on called CFConfig.  It's a command line tool that can help you manage the configuration for any CF server in a simple, portable, and automated fashion.  CFConfig is a CommandBox module that can be used to set, show, import, export, and diff configuration on Adobe CF and Lucee servers.  This project is still in an alpha state, but it ready for people to start kicking the tires and providing feedback.

Update 5/29/2018: CFConfig now has official documentation here:

https://cfconfig.ortusbooks.com/

What it manages

 CFConfig gives you the ability to manage most every setting that shows up in the web administrator, but instead of logging into a web interface, you can manage it from the command line by hand or as part of a scripted server setup.  You can seamless transfer config for all the following:

  • CF Mappings
  • Datasources
  • Mail servers
  • Request, session, or application timeouts
  • Licensing information (for Adobe)
  • Passwords
  • Template caching settings
  • Basically any settings in the web based administrator

Where it manages

CFConfig will work on any CF server regardless of how it was installed.  Since it interacts directly with the config files, the server doesn't need to be running.  Heck, the server doesn't even need to be installed yet!  CFConfig can be used to write out config files before you even start a CommandBox server for the first time.  

But it's not just for CommandBox servers.  All you need is the folder path to the CF home in your server installation and you can point the CFConfig library at it.  This means CFConfig can be used for syncing config across existing servers, standing up docker containers, or provisioning Vagrant VMs.

How it manages

CFConfig interfaces directly with the XML and property files used by your CF engine to store its configuration.  It takes care of translating the config properly so you use the same commands regardless of what engine you're managing the config for. The tool will try hard to figure out the version of ColdFusion or Lucee that you have installed and there are hints you can give it as well.  Both ACF and Lucee also have settings to monitor the config files for changes so you don't even need to restart the server to pick up your changes.

Usage

To use CFConfig, you can install it into CommandBox easily like so.  Remember, new versions are coming out on a regular basis right now, so don't forget to update it often (you can just re-run the install command)  These commands will work on any CF engine and if you run them from the root of CommandBox server they will "just work" as it will "find" the server for you.  To run these commands against another type of server, you'd need to specify a folder path for the "from" or "to" parameters that pointed to the server home directories.  

CommandBox> install commandbox-cfconfig

Now that you've got the tool installed you can dig into the command help to see where to go from there.  Here's a quick overview of some of the commands.  Run the built-in command help for more info on each one.

View a setting

CommandBox> cfconfig show requestTimeout

Set a setting

CommandBox> cfconfig set requestTimeout=0,0,10,0

View all settings for a server

CommandBox> cfconfig show

Add, list, and delete a CF Mapping

CommandBox> cfconfig cfmapping save virtual=/foo physical=C:/bar
CommandBox> cfconfig cfmapping list
CommandBox> cfconfig cfmapping delete /foo

Add, list and delete a datasource

CommandBox> cfconfig datasource save name=myDSN dbdriver=mysql host=localhost port=3306 database=myDB username=brad password=foobar
CommandBox> cfconfig datasource list
CommandBox> cfconfig datasource delete myDSN

Export all settings from a server

CommandBox> cfconfig export .CFConfig.json

Import settings into a server

CommandBox> cfconfig import .CFConfig.json

Transfer settings from one server to another

CommandBox> cfconfig transfer from=oneServer to=anotherServer

Diff all the settings between two servers

CommandBox> cfconfig diff to=anotherServerName
CommandBox> cfconfig diff to=anotherServerName --fromOnly
CommandBox> cfconfig diff to=anotherServerName --toOnly
CommandBox> cfconfig diff to=anotherServerName --valuesDiffer

Where's a list of all the possible settings?

That's a good question.  If you hit tab while typing "cfconfig show" or "cfconfig set" from the interactive shell, you'll get tab completion.  I don't have a good comprehensive list just yet as it's changing a lot.  The best place to look right now is at the actual list of cfproperties in the BaseConfig object which you can find here.  Each option is commented along with all the valid values you can specify.

https://github.com/bdw429s/cfconfig/blob/master/models/BaseConfig.cfc#L35-L282

Video intro

Here's a quick screen cast I've made that shows installation and a demo of most all the commands above 

 

Add Your Comment

(4)

Mar 08, 2017 08:44:40 UTC

by John Farrar

How do we connect to an active ColdFusion instance. It seems to work great for the Lucee dev instances that run when creating new box instances. I don't see how to wire it to the ColdFusion that is installed though.

Mar 08, 2017 10:07:44 UTC

by Brad Wood

Hi John, this question would be better suited for the Slack team or our CommandBox google group. It sounds like you're using cfconfig with servers you've started with CommandBox. There is no difference in use between Lucee or Adobe. I'd have to understand more about what you're doing. If you've started more than one engine in the same web root, you'll need to specify the name of the server you're trying to target. Otherwise, the command will just pick the first one it finds. Also note, CFConfig does not connect directly to a running server process. It only parses and writes to the config files on disk, so whether or not the server is running doesn't matter.

Mar 08, 2017 10:54:36 UTC

by Jim

Nice timing. Working on a Vagrant box setup and was wondering if I could hack the config files on initial config. This will work great (hopefully) :)

May 04, 2017 10:04:45 UTC

by Mike Collins

Thanks Brad, I was just asked about something like this for a CF2016 migration project. This type of bootstrapping instances will be perfect for Containers or VMs. Definitely will be checking it out and recommending it.

Recent Entries

BoxLang 1.0.0 Beta 23 Launched

BoxLang 1.0.0 Beta 23 Launched

The latest release of BoxLang, Beta 23, marks a significant step forward in our journey to create the ultimate dynamic language for the JVM. Packed with powerful new features, important bug fixes, and thoughtful optimizations, this update is designed to make your development experience smoother, faster, and more reliable, especially after now starting to take 100s of comments and bug reports from our community.

Luis Majano
Luis Majano
November 23, 2024
TestBox Latest Updates and News!

TestBox Latest Updates and News!

We’re thrilled to have launched the new TestBox website and TestBox 6.0! If you haven’t had a chance to explore yet, visit TestBox to discover updated documentation, powerful resources, and features that make testing more efficient than ever.

Maria Jose Herrera
Maria Jose Herrera
November 21, 2024
Is Your ColdFusion Application Ready for the Future?

Is Your ColdFusion Application Ready for the Future?

In a rapidly evolving digital world, maintaining performance, security, and scalability for ColdFusion applications is more challenging than ever. Whether you're using Lucee or Adobe ColdFusion, legacy systems can become a bottleneck for growth, innovation, and user satisfaction. The need to future-proof your ColdFusion applications has never been more critical.

But where do you start?


The Hidden Costs of an Outdated ColdFusion Application

As you...

Cristobal Escobar
Cristobal Escobar
November 21, 2024