-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMerge-ConfigRepository.ps1
More file actions
28 lines (22 loc) · 1.06 KB
/
Merge-ConfigRepository.ps1
File metadata and controls
28 lines (22 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
param (
[ValidateScript({Test-Path -PathType Leaf -Path $_})]
[Parameter(Mandatory=$true, HelpMessage='The location of the storage config.')]
$storageConfig,
$discoveryHost,
$discoveryPort=8082,
[switch]$usePlaceholders=$false
)
Add-Type -Assembly System.Xml.Linq
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
$config = [Xml.Linq.XDocument]::Load($storageConfig)
if ($usePlaceHolders) {
$discoveryServiceUri = "`$`{discoveryurl:-http://$discoveryHost`:$discoveryPort/discovery.svc`}"
$tokenServiceUri = "`$`{tokenurl:-http://$discoveryHost`:$discoveryPort/token.svc`}"
} else {
$discoveryServiceUri = "http://$discoveryHost`:$discoveryPort/discovery.svc"
$tokenServiceUri = "http://$discoveryHost`:$discoveryPort/token.svc"
}
$configRepository = $config.Element('Configuration').Element('ConfigRepository')
$configRepository.setAttributeValue("ServiceUri", $discoveryServiceUri)
$configRepository.setAttributeValue("TokenServiceUrl", $tokenServiceUri)
$config.Save($storageConfig)