Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support token substitution for pre-defined tokens on transformation #144

Open
gharirao opened this issue May 12, 2014 · 1 comment
Open

Comments

@gharirao
Copy link

One of the reasons for config file bloat is the addition of environment-specific transforms for config values that only differ by the environment name.

For e.g. the below config key in web.config

<add key="WebServiceUrl" value="http://devservice.example.com/ws" />

is repeated in web.systemtest.config as

<add key="WebServiceUrl" value="http://systemtestservice.example.com/ws" xdt:Locator="match(key)" xdt:Transform="Replace"  />

and in web.production.config as

<add key="WebServiceUrl" value="http://productionservice.example.com/ws" xdt:Locator="match(key)" xdt:Transform="Replace"  />

In this scenario, the config key in the base web.config can be converted to a tokenized string. The value for the token is input during the transformation process (can be a UI dialog for Preview Transform operation in VS, and command line args during the transformation process on build server) and is replaced during transformation appropriately.

So, the above e.g. would become

<add key="WebServiceUrl" value="http://{ENVIRONMENT}service.example.com/ws" />

in web.config and there would be no repetitions of this key in the environment-specific transforms. The {ENVIRONMENT} token would be replaced with the input value during transformation. The transformation process should be able to handle multiple token replacement (for e.g. with delimiter separated list of substitution values, like ENVIRONMENT:systemtest;USER:stuser; or similar).

The command-line Config Transform Tool (http://ctt.codeplex.com/) has similar functionality (http://outcoldman.com/en/archive/2010/09/09/config-transformation-tool-parameters-support/). Having this functionality in SlowCheetah would bring this to Visual Studio as well as the build process.

@sayedihashimi
Copy link
Owner

Great idea. If anyone out there want's to implement it I will provide guidance & review/merge the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants