@@ -16,7 +16,10 @@ new-module -name "StsCliInstaller" -scriptblock {
1616 param (
1717 [string ]$StsUrl , # url of the StackState instance to configure (empty means don't configure)
1818 [string ]$StsApiToken , # API-TOKEN of the StackState instance to configure (empty means don't configure)
19- [string ]$StsCliVersion # version of the CLI to install (empty means latest)
19+ [string ]$StsCliVersion , # version of the CLI to install (empty means latest)
20+ [string ]$StsCaCertPath , # Path to CA certificate file for HTTPS verification
21+ [string ]$StsCaCertBase64Data , # Base64 encoded CA certificate data for HTTPS verification
22+ [string ]$StsSkipSsl # Skip SSL verification (if set, CA cert options are ignored)
2023 )
2124 # Stop on first error
2225 $ErrorActionPreference = " Stop"
@@ -41,6 +44,7 @@ new-module -name "StsCliInstaller" -scriptblock {
4144 Invoke-WebRequest $CliDl - OutFile $CliPath \stackstate- cli.zip
4245 Expand-Archive - Path " $CliPath \stackstate-cli.zip" - DestinationPath $CliPath - Force
4346 rm $CliPath \stackstate- cli.zip
47+ Write-Host " Downloading $CliPath "
4448
4549 # Register the CLI path to the current user's PATH, if that wasn't already the case
4650 $Path = (Get-ItemProperty - Path " Registry::HKEY_CURRENT_USER\Environment" - Name PATH).Path
@@ -66,7 +70,15 @@ new-module -name "StsCliInstaller" -scriptblock {
6670
6771 # Configure the CLI if config parameters have been set
6872 if ($StsUrl -and $StsApiToken ) {
69- & sts context save -- url $StsUrl -- api- token $StsApiToken
73+ if ($StsSkipSsl ) {
74+ & sts context save -- url $StsUrl -- api- token $StsApiToken -- skip-ssl $StsSkipSsl
75+ } elseif ($StsCaCertPath ) {
76+ & sts context save -- url $StsUrl -- api- token $StsApiToken -- ca- cert- path $StsCaCertPath
77+ } elseif ($StsCaCertBase64Data ) {
78+ & sts context save -- url $StsUrl -- api- token $StsApiToken -- ca- cert- base64- data $StsCaCertBase64Data
79+ } else {
80+ & sts context save -- url $StsUrl -- api- token $StsApiToken
81+ }
7082 if ($LastExitCode -ne 0 ) {
7183 return
7284 }
0 commit comments