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

Feature Request: Allow Json file tokens to be replaced before transforming #92

Open
deadlydog opened this issue Nov 12, 2017 · 1 comment

Comments

@deadlydog
Copy link
Contributor

The Tokenizer task allows secrets to be replaced with Release Management variable values. It also allows a Json file to be used to specify more complex replacements to the configuration file (e.g. web.config file). The problem today is that most developers won't have SomeVariable in their web.config file when they check it into source control; they'll likely have a actual value in the field that corresponds to the Dev environment.

e.g. ApiKey = 123456 instead of ApiKey = __ApiKeySecret__

The json file allows us to replace that 123456 value with __ApiKeySecret__, but that won't be enough to get __ApiKeySecret__ to actually get replaced with the real secret value that's stored in Release Management.

What I've done to work around this is, define my Json file like:

{
	"DansSandbox": {
		"CustomVariables": {
			"ApiKeySecret": "__ApiKeySecretToken__"
		},
		"ConfigChanges": [
			{
				"KeyName": "/configuration/appSettings/add[@key='ApiKeySecret']",
				"Attribute": "value",
				"Value": "__ApiKeySecret__"
			}
		]
	}
}

And then I run the Tokenizer task twice. The first time I run it on the Json file to replace the ApiKeySecretToken variable with the value of the Release Management ApiKeySecretToken variable value.
image

I then run the Tokenizer task again using the Json file (that now contains the actual secret to insert into the config file).
image

This workaround works, but it would be more convenient to have a checkbox that allows the Json file to be token-replaced before being applied against the configuration file (i.e. web.config), as then we would not need to call the tokenizer task twice; just once.

I imagine this wouldn't be too hard to implement, since all of the functionality is already present in the task, but I haven't looked into the code yet. This would be a nice little feature to make the task easily cover more real-world scenarios.

@TheBeardedLlama
Copy link

I agree. It doesn't make sense that the json cannot use variables

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

No branches or pull requests

2 participants