forked from atlassian-labs/msteams-jira-server-addon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setEnvironmentProperties.ps1
49 lines (46 loc) · 1.13 KB
/
setEnvironmentProperties.ps1
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
param
(
[Parameter(Mandatory=$True)]
[string]$filePath,
[Parameter(Mandatory=$True)]
[string]$clientId,
[Parameter(Mandatory=$True)]
[string]$pluginKey,
[Parameter(Mandatory=$True)]
[string]$webServiceAddress,
[Parameter(Mandatory=$True)]
[string]$pluginVersion,
[Parameter(Mandatory=$True)]
[string]$teamsAppBaseUrl
)
try
{
$reader = [System.IO.StreamReader] $filePath
$data = $reader.ReadToEnd()
$reader.close()
}
finally
{
if ($reader -ne $null)
{
$reader.dispose()
}
}
$data = $data -replace "aud_claim=.*","aud_claim=$clientId`r`n"
$data = $data -replace "plugin_key=.*","plugin_key=$pluginKey`r`n"
$data = $data -replace "signalr_hub_url=.*","signalr_hub_url=$webServiceAddress`r`n"
$data = $data -replace "plugin_version=.*","plugin_version=$pluginVersion`r`n"
$data = $data -replace "teams_app_base_url=.*","teams_app_base_url=$teamsAppBaseUrl`r`n"
try
{
$writer = [System.IO.StreamWriter] $filePath
$writer.write($data)
$writer.close()
}
finally
{
if ($writer -ne $null)
{
$writer.dispose()
}
}