Skip to content

Commit

Permalink
Update powershell script to allow using ConfigDir for multiple config…
Browse files Browse the repository at this point in the history
…urations (OctopusDeploy OctopusDeploy#377)
  • Loading branch information
xxkel-sd committed Jun 15, 2022
1 parent 5b75633 commit 353b282
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions docker/windows/Scripts/configure-tentacle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ function Register-Tentacle(){
Execute-Command $TentacleExe $arg $mask;
}

function ConfigureFromFile($content) {
Get-Content $_ | Foreach-Object{
$var = $_.Split('=')
New-Variable -Name $var[0] -Value $var[1] -Force
}
Validate-Variables
Register-Tentacle
}

try
{
Write-Log "==============================================="
Expand All @@ -309,11 +318,23 @@ try
exit 0
}

Validate-Variables
Write-Log "==============================================="
if($ConfigDir -eq $null) {
Validate-Variables
Write-Log "==============================================="

Configure-Tentacle
Register-Tentacle
} else {
if (!(Test-Path -Path $ConfigDir)) {
throw "Config directory ($ConfigDir) doesn't exist!"
}
Configure-Tentacle
Get-ChildItem $ConfigDir -Filter *.conf |
Foreach-Object {
ConfigureFromFile $_
}
}

Configure-Tentacle
Register-Tentacle
"Configuration complete." | Set-Content "c:\octopus-configuration.initstate"

Write-Log "Configuration successful."
Expand Down

0 comments on commit 353b282

Please sign in to comment.