Yes, that's what I've done.

The application.cfc simply runs a query based on the domain name
and returns all the variable values, that are then set once as
application variables.  The application.cfc doesn't contain
any hard-coded values.

There's no need to clutter up the application.cfc with all the
domain values.  Getting them from the database is more efficient.
I just have to tweak the database and add values as the app grows.

-----Original Message-----
From: Jason Fisher [mailto:[email protected]] 
Sent: Thursday, February 17, 2011 3:04 PM
To: cf-talk
Subject: Re: Feedback on this approach to "many sites, one codebase" (MSOC)


+1 to databasing all of it ... if you've got a system where these things 
change a lot, particularly new domains that might impact the 
Application.cfc, then definitely push the config to the database.  As was 
mentioned before, you can handle redirects there as well:  if domain.com is 
found in the DB and if the database record for that domain has a redirect 
to www.domain.com, then handle the redirect.  Allows you to abstract it all 
in Application.cfc while giving you great flexibility in the administration 
of it.

----------------------------------------

From: "Steve Bryant" <[email protected]>
Sent: Thursday, February 17, 2011 2:45 PM
To: "cf-talk" <[email protected]>
Subject: Re: Feedback on this approach to "many sites, one codebase" 
(MSOC)

I prefer to have the domain names in a database mapped to a primary domain 
name or an application name. This allows me to have a UI to enter new 
domain names as they are needed (we add them pretty frequently).

That also allows you to write code to your web server to add bindings for 
each domain name to your web site. If your DNS server allows, then you can 
also automatically put in the DNS entry there. If you have a large MSOC 
system that frequently adds domain names then a little automation can go a 
long way.

Steve

>I usually use CFSWITCH and assign my own app names, which allows me to use 

>the built-in list nature of CFCASE values:
>
>
><cfswitch expresssion="#cgi.server_name#">
><cfcase value="domain.com,www.domain.com">
>       <cfset appName = "domain" />
></cfcase>
><cfcase value="mydomain.com,www.mydomain.com">
>       <cfset appName = "mydomain" />
></cfcase>
><cfcase value="blog.domain.com">
>       <cfset appName = "domainBlog" />
></cfcase>
></cfswitch>
>
>
>etc etc ... that way my onApplicationStart is basically mapping 1-to-1 
with 
>my application config table, but I can throw as many domain variations at 

>it as I want to. 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342415
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to