CF Builder tip: add vhosts to servers in bulk!
Our main project at work is a work in progress... it's old, and it uses subdomains to trigger changes in the way the codebase is handled. What that means to builder is having one instance of CF powering a great many vhosts. Now, I dunno about you, but I REALLY hate adding vhosts to Builder using the panel in the Server properties. But, I'm here to tell you, there's an easier way!
Before you do this, please backup your workspace folder. /silly disclaimer
If you go into the folder {workspace}/.metadata/.plugins/com.adobe.ide.coldfusion.server you'll find a file called Server.xml. The first issue you'll have is that the XML is entirely unformatted. If you're not using an XML editor that supports automatic formatting, try using a text editor that supports regex find/replace and replacing "><" with ">\r\n<" on Windows or ">\r<" on OS X.
If you open that file up, you'll see your configured servers. Each server contains quite a number of properties, more than I can really deal with right now. But, if you have already configured one vhost, you should see a subtag of
2 <VirtualHost>
3 <Name>My Nifty Virtual Hosts</Name>
4 <Address>wibble.mydevserver.dev</Address>
5 <Port>80</Port>
6 <Location>C:\inetpub\www\wibble</Location>
7 <EnableSSL>false</EnableSSL>
8 </VirtualHost>
9</VirtualHosts>
You can now duplicate this
There is one very crucial gotcha!
CF Builder does a couple interesting things that could really mess you up if you're not aware of them. First, all configs are read when the app starts up, so you need to have these changes in place and THEN open Builder. Also, when you exit the program, it flushes all the settings to disk, so if you edit the Server.xml file with Builder, save it, and then exit the program, you've just lost all your changes. So you need to either shut Builder down and use a different editor to make the changes, or you need to edit the file, do a Save As... outside the workspace folder, then copy it over the one that's there by hand.
Once you've got the changes saved to disk and the edited file in {workspace}/.metadata/.plugins/com.adobe.ide.coldfusion.server, you can start up Builder, double-click the server in the Servers tab and take a peek at the Virtual Hosts section of the second page. You should see that you've just saved yourself a great deal of effort by editing the config file directly rather than using the futsy-putsy UI.
Either way, I just added 11 vhosts to my server config using copy/paste/change instead of 45 minutes of tabbing, clicking and complaining.
Laterz!
