Moving configurations to database

Moving configurations to database

October 24, 2011 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

With the release of Sitefinity 4.0 we have moved from storing Sitefinity related configurations in web.config to providing our on configuration persistence in the Sitefinity config files.This is the default setting for storing configurations and all of your settings are stored in the ~/App_Data/Sitefinity/Configuration/. When we released our support for multiple instances on Windows Azure we had to allow users to store configurations in the database, otherwise your Azure instances would not run with the same settings if you made any changes in the Administration -> Settings area of Sitefinity.This feature allows you to set up your Sitefinity website to store all configurations in the database, it can be used on non-Azure projects. Here is how you can set up database configurations storage:

1) Create a new project with the Sitefinity Project Manager. Instead of opening the project in the browser to set it up, open it in Visual Studio.

2) After you have opened the project in Visual Studio and go to your web.config file. Uncomment the telerik configuration section:

<sectionGroup name="telerik">
  <section name="sitefinity" type="Telerik.Sitefinity.Configuration.SectionHandler, Telerik.Sitefinity" requirePermission="false" />
</sectionGroup>

Set up your database storage mode:

<telerik>
  <sitefinity>
    <!--<environment platform="WindowsAzure"/>-->
    <sitefinityConfig storageMode="Database" />
  </sitefinity>
</telerik>

After this operation you can run the project in the browser and instantiate it. It will create a connectionString setting in your web.config which will point to your database. Please note that for this operation you need to have the website identity be able to write/modify the web.config file. When the website is created there will be only two files in ~/App_Data/Sitefinity/Configuration. Those files will be ProjectConfig and SecurityConfig.

If your environment does not allow writing to the web.config file you can fist set up the project and then go to setting configurations to be stored in database. If you choose this approach, you will have the a few files in ~/App_Data/Sitefinity/Configuration that are created when the project is instantiated. Those files contain default configurations created when each project is ran for the first time and are necessary for the project's proper operation. You can eliminate the DataConfig file by moving your connection string to the web.config file as Vladi has outlined in this forum post.Any further configuration change will be persisted in the database.

This approach is very useful in a number of scenarios, for example setting up the project in NLB environment and using different file systems for each load balanced server. You can also prevent exposing SMTP settings in the config files, LDAP connection strings as well as other sensitive information.

progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments
Comments are disabled in preview mode.
Topics
 
 
Latest Stories in
Your Inbox
Subscribe
More From Progress
New_Mobile_Dev_Ebook_Progress_Website_Thumbail
The New Mobile Development Landscape
Download Whitepaper
 
IDC Spotlight Sitefinity Thumbnail
Choosing the Right Digital Experience Platform to Improve Business Outcomes
Download Whitepaper
 
TheFastestWayToBuildMobileAppsArtboard-2
The Fastest Way to Build Mobile Apps With Cloud Data
Watch Webinar