CFConfig
Background
CFConfig is a CommandBox module which allows most if not all of the CF / BoxLang settings for a server to be set via a JSON file rather than using the CFAdministrator. This makes it much easier to scaffold servers in various situations such as:
Keeping development environments up to date
Production servers with their own passwords / mappings / data sources etc
Development Environment
Containers
Some Examples
Mappings
Create a folder outside of the root folder called JEMapps
In JEMapps, create a text file called
outsideroot.txtand put some text into it.From CommandBox, install
install commandbox-cfconfigFrom CommandBox, from the root of the site, type
cfconfig cfmapping save virtual=/JEMapps physical=path\to\JEMapps to=.cfconfig.jsonType
cat .cfconfig.jsonRestart your server with
server restartIn your index.cfm file, add:
<cfdirectory directory="#expandpath('/JEMapps')#" name="listing" /> <cfdump var="#listing#" /> <cffile action="read" file="#expandpath('/JEMapps/outsideroot.txt')#" variable="read" /> <cfdump var="#read#" />
Datasources
From CommandBox, from the root of the site, type
cfconfig datasource save database=DATABASENAME
dbdriver=mysql
host=justenough.cyqisqc1fx3i.us-west-2.rds.amazonaws.com
username=USERNAME
password=PASSWORD
port=3306
name=justEnough
class=com.mysql.cj.jdbc.Driver
to=.cfconfig.json
Restart the server ( server restart ). We're going to investigate that datasource more very soon but for now if there are no errors, the datasource is set up correctly.
Last updated