Sitecore Core Development

Saturday, January 21, 2006

site.config

I have added a small feature for configuring sites outside the web.config - let's see if Ole approves it.

In the site resolver, I have added functionality to look for a site.config file in the current directory. If such a file exists, the site configuration is read from that file. This make it possible to define sites much more flexible (at a cost of course).

Here is an example of a site.config file:
<site
rootPath="/sitecore/content"
startItem="/home"
language="en"
database="core"
domain="sitecore"
loginPage="/sitecore/login"
content="master"
enableWorkflow="true"
xmlControlPage="/sitecore/shell/default.aspx"/>

You can also use a reference to a site defined in the web.config. In that case the site.config file looks like this:

<site reference="shell">

The cost of this is performance. For each request, Sitecore has to check for the existance of a site.config file. If found, the file is read and parsed into an Xml document. While not overly concerning, it does hurt performance slightly.

What it doesn't do: A site.config file does not work recursively on folders. Sitecore does not look for site.config files in parent folders, so you will have to place a site.config in every subfolder. The reason for this is performance.

2 Comments:

  • I really need this, please please please release this into 5.1.x version!

    you help is very much appreciated if you can convert other section as well (esp. database connection settings, data folder settings, etc)

    By Blogger cutetechie, at 1:06 AM  

  • This is a great idea and much more needs to come out of the web.config.

    It is very annoying to have the webserver reset for configuration changes.

    An idea I have to solve performance: Load everything to memory from these outside config files that the Sitecore HTTP module would reference. Have a reload button in Sitecore somewhere that can reload the settings from memory. This is how a few other products I have used have solved these problems.

    Bryan

    By Anonymous Anonymous, at 9:55 AM  

Post a Comment

<< Home