Changing the fileRoot or imageRoot in FC7


#1

Hi All,
There have obviously been some big changes from 6 to 7.
In FC6 I set the application.url.fileRoot in _serverSpecificVarsAfterInit.cfm and that seems to be enough.
But after updaing to FC7, a bit of hair pulling and stepping through the code, it looks like you need to re-init the cdn as well now.
Ergo, my entry in _serverSpecificVarsAfterInit.cfm now looks like this:
<cfset application.url.fileRoot = "#application.url.webroot#/mynewlocation/files"> <cfset application.fc.lib.cdn.init()>

I’m not sure if I’m doing this right (someone may haveanother suggestion) but I though I’d put it here in case someone else comes across the same issue.

Phil


#2

Hey Phil,

I think the modification of the fileroot application scoped variable is deprecated in favour of configuring the CDN location that you are working with (note: the local file system corresponds to the “local” CDN type, e.g. cdn="local" in the code below).

In your _serverSpecificVarsAfterInit.cfm you can add;

<cfset application.fc.lib.cdn.setLocation(
    name="publicfiles",
    cdn="local",
    fullpath=expandPath("/mynewlocation/files"),
    urlpath=("/mynewlocation/files")
)>

You can change the settings for any of the built-in CDN locations, and you can even define your own locations if the need arises :slight_smile:

For some more info see https://farcry.jira.com/wiki/display/FCDEV60/Working+With+CDNs


#3

Thanks Justin,
I did see setLocation but thought it looked a bit long winded and wan’t sure of any down stream effects. But your example tells me otherwise :slight_smile:

Cheers
Phil


#4

Did you also try setting the variable in _serverSpecifcVars.cfm?

Blair