Cinchoo is the application framework for .NET. One of the main functionalities that it provides to the users is application configuration management. Application configuration is the information that the application reads and/or writes at run-time from the source. Please take a look at 'Cinchoo - Simplified Configuration Manager' jump start article on using configuration framework in your application.
In this section, I'll talk about a way to hook up the existing configuration files to your files through application configuration file. And how to set environment specific configuration files to the applications.
Using Existing Configuration Files
If you have existing configuration files or you want to share the configuration files with multiple applications, you can do so by specifying the folder path in the application configuration file (App.config) as below:
<section name="appFrxSettings" type="Cinchoo.Core.ChoAppFrxSettings, Cinchoo.Core" />
sharedEnvironmentConfigFilePath="" appEnvironment="" />
As you probably know, it is custom configuration section '
Cinchoo.Core.ChoAppFrxSettings' defined in App.config file.
appFrxFilePath - Optional. Absolute path to the configuration files directory to use by your application. If not given, 'Config' folder will be created under executable directory.
sharedEnvironmentConfigFilePath - Optional. Absolute/relative file path of shared environment configuration file. If not passed, your applications will not be using any environment specific configuration files.
appEnvironment - Optional. Environment name, the application will pick up the configuration files tied to the environment. If not specified, will pickup the configuration files tied to the machine from environment configuration file.
In a situation, where you want to keep and maintain configuration files for each environment (DEV, UAT and PROD, etc.) separately in a centralized location and have them discovered and attached to your application automatically, all of them can be done through Shared Environment Configuration file.
Normally Cinchoo framework discovers this file (SharedEnvironment.config) in the application configuration folder if not specified explicitly. It can be overridden to different file path through '
sharedEnvironmentConfigFilePath' attribute in the above section in App.config file.
Specification of the
SharedEnvironment configuration file is as below:
<environment name="DEV" appFrxFilePath="Config\DEV" freeze="true" >
<environment name="PROD" appFrxFilePath="C:\Config\PROD" freeze="true" >
<environment name="UAT" >
Each environment can be given with '
environment' section with '
name' attribute, aka environment name. Group of machines can be associated with environment through '
machine' elements. Wild card values may be accepted as machine names. Machine names can be IP addresses or readable machine names.
An environment may be frozen (locked) by specifying '
freeze' tag to
true. It means that the application environment is locked for those machines. Your applications running on those machines can NOT be overridden the environment through '
appEnvironment' attribute in the
ChoAppFrxSettings section in the App.config file.
Path to configuration files for each environment can be given through '
appFrxFilePath' attribute. It can be either absolute or relative file path to a folder.
Any machines not configured/specified in this shared environment file will pick up the configuration files that belong to environment specified in '
defaultEnvironment' attribute in '
That's all folks. Try for yourself.