I have the following file ocelot.json and I want to change the Host object of each route configured inside the file through a variable. I want to change the localhost to the correct hostname through a variable.
"Routes": [
//ParĂ¡metricas
{
"UpstreamPathTemplate": "/api/ClasificacionEquipo",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 19007
}
],
"DownstreamPathTemplate": "/api/ClasificacionEquipo",
"FileCacheOptions": {
"TtlSeconds": 3600,
"Region": "parametricas"
}
},
{
"UpstreamPathTemplate": "/api/ClasificacionEquipo/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 19007
}
],
"DownstreamPathTemplate": "/api/ClasificacionEquipo/{id}",
"FileCacheOptions": {
"TtlSeconds": 300,
"Region": "parametricas"
}
}
]
I create the following variable but it doesn't take me the change: Routes.DownstreamHostAndPorts.Host.
I have also tried as follows: Routes.*.DownstreamHostAndPorts.0.Host
And it hasn't worked for me
If you want to do file transformation of JSON files in ADO we have the FileTransform@1 task
More info on this https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/file-transform?view=azure-devops