@@ -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"
@@ -64,9 +67,28 @@ new-module -name "StsCliInstaller" -scriptblock {
6467 return
6568 }
6669
70+ # Validate SSL/CA certificate parameters
71+ if ($StsSkipSsl ) {
72+ if ($StsCaCertPath -or $StsCaCertBase64Data ) {
73+ Write-Host " [WARNING]" - ForegroundColor Red - NoNewLine
74+ Write-Host " StsSkipSsl is set, ignoring StsCaCertPath and StsCaCertBase64Data"
75+ }
76+ } elseif ($StsCaCertPath -and $StsCaCertBase64Data ) {
77+ Write-Host " [WARNING]" - ForegroundColor Red - NoNewLine
78+ Write-Host " Both StsCaCertPath and StsCaCertBase64Data are set, StsCaCertPath takes precedence"
79+ }
80+
6781 # Configure the CLI if config parameters have been set
6882 if ($StsUrl -and $StsApiToken ) {
69- & sts context save -- url $StsUrl -- api- token $StsApiToken
83+ if ($StsSkipSsl ) {
84+ & sts context save -- url $StsUrl -- api- token $StsApiToken -- skip-ssl
85+ } elseif ($StsCaCertPath ) {
86+ & sts context save -- url $StsUrl -- api- token $StsApiToken -- ca- cert- path $StsCaCertPath
87+ } elseif ($StsCaCertBase64Data ) {
88+ & sts context save -- url $StsUrl -- api- token $StsApiToken -- ca- cert- base64- data $StsCaCertBase64Data
89+ } else {
90+ & sts context save -- url $StsUrl -- api- token $StsApiToken
91+ }
7092 if ($LastExitCode -ne 0 ) {
7193 return
7294 }
0 commit comments