Right now my config.xml file resides where it can be browsed and read easily.
Ray C. helped me a while back on how to secure it. One of the options is to
place outside the root and read it. This needs to work with a shared host so
that's not a good option. Another was to setup a defaults.cfm file with the xml
commented out. Then you read the file, taking out the comments. If someone
browses to the file, they'd see nothing.
Could you use <cfxml> to do somethin along these lines? How does everyone else
do this?
Could I see some examples? Here's what I've got now.
<!--- Read config.xml and save all the values for use in APPLICATION scope--->
<cffunction name="loadApplicationVariables" returntype="void" output="false">
<cfset var serverName = "production">
<cfset var xmlFilePath = "D:/inetpub/*******/****/config.xml">
<!--- <cfset var xmlFilePath = "C:/cfusionmx7/wwwroot/******/config.xml">--->
<cfset var key = "">
<cfset var thevalues = "">
<!--- Read and create a new CF XML document object--->
<cfset thevalues = XMLparse("#xmlFilePath#")>
<!--- Create a struct with the setting values--->
<cfset APPLICATION.settings = StructNew()>
<!--- Loop over the keys, saving their values to APPLICATION scope --->
<cfloop item="key" collection="#thevalues.settings[serverName]#">
<cfset APPLICATION.settings[key] =
thevalues.settings[serverName][key].xmltext>
</cfloop>
</cffunction>
Thanks,
Will
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:251101
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4