diff --git a/consul/consul.nuspec b/consul/consul.nuspec index 68f52523..3557b1a9 100644 --- a/consul/consul.nuspec +++ b/consul/consul.nuspec @@ -18,9 +18,19 @@ Consul is a tool for service discovery and configuration. Consul is distributed, Uses NSSM as the service wrapper. More info at: https://nssm.cc/ #### Package Parameters -The package parameters can be set - https://www.consul.io/docs/agent/options.html -These parameters can be passed to the installer with the use of `-params`. -For example: `-params '-config-file="%PROGRAMDATA%\consul\dsc-config\default.json"'`. +The package parameters can be set - + + * `/noservice` - Disables installation of Windows service + * `/apiaddr` - Sets environment variable `CONSUL_HTTP_ADDR` for easy execute commands on remote agent + +These parameters can be passed to the installer with the use of `--params`. +For example: `--params="'/noservice /apiaddr=http://10.0.0.1:8500'"`. + +#### Installer Arguments +Consul agent runtime options can also be set via `--ia`: https://developer.hashicorp.com/consul/docs/agent/config/cli-flags + +For example: `--ia='-config-file ""%PROGRAMDATA%\consul\dsc-config\default.json/"" -client 10.0.0.1'` +Or better, drop a `config.hcl` into `%PROGRAMDATA%\consul\config` with your configuration. &1 | Out-Null -SchTasks.exe /Delete /F /TN "ConsulLogrotate" 2>&1 | Out-Null - -Write-Host "Removing C:\ProgramData\consul\ ..." -takeown /f "C:\ProgramData\consul\" /a /r /d Y | Out-Null -icacls "C:\ProgramData\consul" /grant administrators:F /t | Out-Null -Remove-Item -Path "C:\ProgramData\consul\" -Force -Recurse -ErrorAction SilentlyContinue | Out-Null + Write-Host "Removing C:\ProgramData\consul\ ..." + takeown /f "C:\ProgramData\consul\" /a /r /d Y | Out-Null + icacls "C:\ProgramData\consul" /grant administrators:F /t | Out-Null + Remove-Item -Path "C:\ProgramData\consul\" -Force -Recurse -ErrorAction SilentlyContinue | Out-Null +} diff --git a/consul/update.ps1 b/consul/update.ps1 index f97f7d93..0b866aed 100644 --- a/consul/update.ps1 +++ b/consul/update.ps1 @@ -1,15 +1,18 @@ Import-Module chocolatey-au function global:au_SearchReplace { - @{ } + @{ + 'tools\chocolateyinstall.ps1' = @{ + "(\t*Url\s*=\s*)('.*')" = "`$1'$($Latest.Url32)'" + "(\t*Url64bit\s*=\s*)('.*')" = "`$1'$($Latest.Url64)'" + "(\t*Checksum\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'" + "(\t*Checksum64\s*=\s*)('.*')" = "`$1'$($Latest.Checksum64)'" + } + } } . ../_scripts/GitHub.ps1 -function global:au_BeforeUpdate() { - Get-RemoteFiles -Purge -NoSuffix -} - function global:au_GetLatest { # This repo has releases for the cli tool as well as VS Code vsix $release = Get-GitHubLatestRelease "hashicorp/consul" @@ -25,9 +28,9 @@ function global:au_GetLatest { } $Latest = @{ - Version = $version - Url32 = "https://releases.hashicorp.com/consul/$version/consul_$($version)_windows_386.zip" - Url64 = "https://releases.hashicorp.com/consul/$version/consul_$($version)_windows_amd64.zip" + Version = $version + Url32 = "https://releases.hashicorp.com/consul/$version/consul_$($version)_windows_386.zip" + Url64 = "https://releases.hashicorp.com/consul/$version/consul_$($version)_windows_amd64.zip" ReleaseNotes = $release.body.Replace("# ", "## ") # Increase heading levels } return $Latest @@ -37,4 +40,4 @@ function global:au_AfterUpdate ($Package) { Update-ReleaseNotes $Package } -update \ No newline at end of file +update