different directories for different environments

Hey Luis et al,
  I have a large codebase where, on dev, all the view files are in a
shared directory called "SharedCodebase". This directory lives right
off the webroot, i.e. inetpub\wwwroot\SharedCodebase. This same
codebase houses the display code and a bunch of other stuff (not
CFCs... they're managed separately). This shared codebase is used by a
dozen or so other applications (we have a big ole' flagship product,
and each client gets a new 'version' of the application, but we try
like hell to keep each client application using the code from the
shared codebase).

so i've got wwwroot\ClientA and wwwroot\ClientB and so forth.
Currently this is a waaaaay old fusebox app. We set a variable in
application.cfc called "application.codebase", and that variable is
set to either /SharedCodebase/ on dev or /ClientA/SharedCodebase in
all other environments. Our index files, then, reference this
variable in all of the cfincludes.

So in our index file for each client app, we'll have stuff like this:

<cfinclude template="#application.codebase#/documents/dsp/dsp_someFile.cfm">

This way, in dev, all client apps are always pointing at the shared codebase.

However, when we move the apps to test, staging, and production, we
actually Copy the SharedCodebase directory INSIDE of the application.
and then in those environments, "application.codebase" no longer
points to wwwroot\SharedCodebase but instead to
wwwroot\ClientA\SharedCodebase.

In this manner we can keep clients using shared code on dev and do a
good job of keeping the apps in sync, but when we deploy to different
environments we ensure that we don't affect other applications on the
same machines.

The nice thing about this is that no code at all has to change in our
index files.... application.baseroot simply points to a new location
on the file system.

However, as I get started with coldbox, I'm not seeing an easy way to
achieve the same thing. In essence, what I'd like to do is say:

"hey, coldbox, on DEV, go to wwwrooot\SharedCodebase for your view
files. But in other environments, go to
wwwroot\ClientA\SharedCodebase".

Is this possible?

Thanks!

Marc

Take a look at the Environment Interceptor and ViewsExternalLocation Settings.

Ernst

Ernst,
  Thanks for responding so quickly. So I was digging through the code
and, if i'm reading it right (it's unbelievably easy to read and
understand, by the way), if a view file exists in the conventions
directory, it'll pick it up. otherwise, it'll look in the external
config directory.

  So, basically, i just need to make sure those files don't exist in
the conventions directory in DEV, which is how it'd be anyway. and
then when they're copied into the app upon deployment, i don't need to
change anything at all. which basically means as long as i have the
external config location set up correctly, then it should "just work"
in each environment.

is that about right?

Marc

I’m not Ernst, but that is exactly how it works. :slight_smile:

Matt is right, but is a good thing to (read you should!) separate dev and production systems.