More in this section

Forums / General Discussions / Config differences between environments and multiple config files

Config differences between environments and multiple config files

3 posts, 0 answered
  1. Aligma
    Aligma avatar
    3 posts
    Registered:
    15 Sep 2010
    28 Jan 2011
    Link to this post
    Hi

    One significant difference between the way Sitefinity 3 and 4 work is the way the partial configs are selected. Because of the way our build process works here, this is causing an issue for me.

    In the past I've updated web.config which had references to a data.local.config, data.dev.config, data.staging.config, and data.production.config depending on the environment the code was deployed to. NAnt scripts would automatically update this reference by editing the xml of web.config to point to the appropriate partial config.

    This means that some important criteria are satisfied
    - all configuration information is stored in partial config files which are a part of the project, and therefore in source control
    - we can tell which configuration is being used just by looking at the properties set in web.config so when investigating any issues on staging or production environments we can easily and accurately determine which partial configs are being used

    DataConfig.config is referenced and loaded from somewhere in the code that's not exposed to the developer - as far as I have been able to determine.

    Is there a way I can override how this partial configuration is selected, and if not can you suggest an alternative method of supporting multiple configs?

    Regards

    David
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    31 Jan 2011
    Link to this post
    Hi David,

    If you mean only the database configuration (connection strings), you can still use the old approach, because Sitefinity data configuration is implemented to work with both DataConfig.config and web.config. However, bare in mind that, if you have connection strings with the same name, that one in the DataConfig.config will override the other one in the web.config.
    Can you specify what kind of configuration you want to differentiate between environments?

    Regarding Sitefinity 4.0 configuration, you could have different configuration in different context. This could be accomplished by Configuration Policy. Currently, we have 2 policy handlers: UserPolicyHandler and RolePolicyHandler. For example, you can persist different configuration settings a specific user( or role), then if the current user is this user (or belongs to this role), this settings are applied.
    It is not implemented yet, but, in the same way, you could implement a custom PolicyHandler, e.g EnvironmentPolicyHandler or DomainPolicyHandler, and persist different configuration for different environments. We hope to include this functionality in the Q2 as a part of the Personalization module, which will be based on configuration policies.
    We hope this will handle any scenario. Please, do let us know if you have any notes?


    Greetings,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Aligma
    Aligma avatar
    3 posts
    Registered:
    15 Sep 2010
    04 Apr 2011
    Link to this post
    Hi Vlad

    I ended up solving this using Cruise Control and nAnt scripts to modify xml nodes on deployment. For example:

    <xmlpoke
        file="${output.dir}\Web.config"
        xpath="/configuration/appSettings/add[@key='PublicUrl']/@value"
        value="${PublicUrl}" />

    Regards

    David
3 posts, 0 answered