Superskyyy commented on code in PR #690:
URL: 
https://github.com/apache/skywalking-website/pull/690#discussion_r1527660007


##########
content/quickstart-docker.ps1:
##########
@@ -0,0 +1,142 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Default values for SkyWalking versions
+$SW_VERSION = "9.7.0"
+$SW_BANYANDB_VERSION = "0.5.0"
+
+$env:BANYANDB_IMAGE = "apache/skywalking-banyandb:$SW_BANYANDB_VERSION"
+$env:OAP_IMAGE = "apache/skywalking-oap-server:$SW_VERSION"
+$env:UI_IMAGE = "apache/skywalking-ui:$SW_VERSION"
+
+# Unset the SW_STORAGE environment variable at the start of the script
+Remove-Item Env:\SW_STORAGE -ErrorAction Ignore
+
+# Ensuring script stops on error
+$ErrorActionPreference = "Stop"
+
+$storageOptionProvided = $false
+$detachOptionProvided = $false
+
+# Function to display usage information
+function Show-Usage {
+    Write-Host "Usage: quickstart-docker.ps1 [-h/--help] [-f] [--storage 
<storage_option>]"
+    Write-Host "Options:"
+    Write-Host "  -h/--help           About running the quickstart script 
without interaction"
+    Write-Host "  -d                  Run in background mode (docker compose 
up -d)"
+    Write-Host "  -f                  Run in foreground mode (docker compose 
up)"
+    Write-Host "  --storage <option>  Set the storage option (elasticsearch or 
banyandb)"
+    exit
+}
+
+# Process command-line arguments
+for ($i = 0; $i -lt $args.Length; $i++) {
+    switch ($args[$i]) {
+        "-h" { Show-Usage; exit }
+        "--help" { Show-Usage; exit }
+        "-d" { $DETACHED = $true; $detachOptionProvided = $true; }
+        "-f" { $DETACHED = $false; $detachOptionProvided = $true; }
+        "--storage" {
+            if ($i -lt $args.Length - 1) {
+                $env:SW_STORAGE = $args[++$i]
+                $storageOptionProvided = $true
+                # Validate storage option if provided
+                if ($storageOptionProvided -and -not ($env:SW_STORAGE -eq 
"elasticsearch" -or $env:SW_STORAGE -eq "banyandb")) {
+                    Write-Host "Invalid storage option: $env:SW_STORAGE. Valid 
options are 'elasticsearch' or 'banyandb'."
+                    exit 1
+                }
+            }
+            else {
+                Write-Host "Error: --storage option requires an argument."
+                exit 1
+            }
+        }
+        default {
+            Write-Host "Invalid option: $($args[$i]), try -h or --help"
+            exit 1
+        }
+    }
+}
+
+
+if (-not (Get-Command "docker" -ErrorAction SilentlyContinue)) {
+    Write-Host "Docker is not found. Please make sure Docker is installed and 
the docker command is available in PATH.`n"
+    exit 1
+}
+Write-Host "Docker is installed, continue...`n"
+
+# In place download
+Invoke-WebRequest -Uri 
"https://github.com/apache/skywalking/raw/master/docker/docker-compose.yml"; 
-OutFile ".\docker-compose.yml"

Review Comment:
   Added new logic to allow user to choose the override behavior, bevause temp 
dir on windows won't be cleared automatically so I figured some people might 
not like that. (and its hard to say if the temp dir logic will work on all 
systems)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to