I've got a pipeline I've created that deploys some app settings to all our websites (multiple per file), and I'm trying to conditionally set a variable within the JSON structure without any sort of anti-patterns.
For conditional variables, all we have this syntax:
${{ if endsWith('EXISTING_STRING','MATCH_STRING') }}:
${{ else }}:
This syntax assumes that you're going to put the entirety of the string after condition, though. If my JSON structure is 50 lines long, I don't want to do that. Is there a way to do this without that cluttered code, whilst avoiding any sort of anti-patterns as well?
Here's the Azure Piplines Module:
- task: AzureAppServiceSettings@1
displayName: 'Deploy App Settings'
inputs:
azureSubscription: "${{ parameters.resource_group_name }}"
appName: "wz${{ parameters.default_environment }}"
resourceGroupName: "${{ parameters.resource_group_name }}"
appSettings: |
[
{
"name": "LaunchUrl",
"value": "False",
/* ^^^^
Value I want to be conditional based off:
if endsWith( parameters['default_environment'], 'matchString'
The resulting string also contains parameters.default_environment FYI
*/
"slotSetting": true
},
{
"name": "DisableFHIR",
"value": "False",
"slotSetting": true
},
...
Thanks