77# of them when querying for the architecture.
88#>
99[System.String []]$SUPPORTED_ARCH = @ (" x86_64" , " arm64" , " amd64" )
10- [System.String []]$SUPPORTED_OS = @ (" linux" , " darwin" , " win32nt" )
11-
12- # Associate binaries with CPU architectures and operating systems
13- [System.Collections.Hashtable ]$BINARIES = @ {
14- " x86_64-linux" = " Parseable_x86_64-unknown-linux-gnu"
15- " arm64-linux" = " Parseable_aarch64-unknown-linux-gnu"
16- " x86_64-darwin" = " Parseable_x86_64-apple-darwin"
17- " arm64-darwin" = " Parseable_aarch64-apple-darwin"
18- " amd64-win32nt" = " Parseable_x86_64-pc-windows-msvc.exe"
19- }
10+ [System.String ]$DOWNLOAD_BASE_URL = " cdn.parseable.com/"
2011
2112# util functions
2213function Get-Env {
@@ -86,12 +77,13 @@ function Get-Env {
8677}
8778
8879# Get the system's CPU architecture and operating system
89- [String ]$CPU_ARCH = [ System.Environment ]::GetEnvironmentVariable( " PROCESSOR_ARCHITECTURE " ).ToLower()
90- [String ]$OS = [ System.Environment ]::OSVersion.Platform.ToString().ToLower()
80+ [String ]$CPU_ARCH = " x86_64 "
81+ [String ]$OS = " windows "
9182[String ]$INSTALLDIR = " ${HOME} \.parseable\bin"
9283[String ]$BIN = " ${INSTALLDIR} \parseable.exe"
9384
9485function Install-Parseable {
86+ Write-Output " `n =========================`n "
9587 Write-Output " OS: $OS "
9688 Write-Output " CPU arch: $CPU_ARCH "
9789
@@ -100,11 +92,6 @@ function Install-Parseable {
10092 Write-Error " Unsupported CPU architecture ($CPU_ARCH )."
10193 exit 1
10294 }
103- # Check if the OS is supported
104- if ($SUPPORTED_OS -notcontains $OS ) {
105- Write-Error " Unsupported operating system ($OS )."
106- exit 1
107- }
10895
10996 Write-Output " Checking for existing installation..."
11097 if (Test-Path $BIN ) {
@@ -119,26 +106,14 @@ function Install-Parseable {
119106 # Get the latest release information using GitHub API
120107 $release = Invoke-RestMethod - Uri " https://api.github.com/repos/parseablehq/parseable/releases/latest"
121108 # Loop through binaries in the release and find the appropriate one
122- foreach ($arch_os in " $CPU_ARCH -$OS " ) {
123- $binary_name = $BINARIES [$arch_os ]
124- $download_url = ($release.assets | Where-Object { $_.name -like " *$binary_name *" }).browser_download_url
125- if ($download_url ) {
126- break
127- }
128- }
109+ $download_url = $DOWNLOAD_BASE_URL + $CPU_ARCH + " -" + $OS + " ." + $release.tag_name
129110
130111 mkdir - Force $INSTALLDIR
131112
132- Write-Output " Downloading Parseable Server... "
113+ Write-Output " Downloading Parseable version $release_tag , for OS: $OS , CPU architecture: $CPU_ARCH `n`n "
133114 # Download the binary using Invoke-WebRequest
134115 Invoke-WebRequest - Uri $download_url - OutFile $BIN
135116
136- # Make the binary executable (for Unix-like systems)
137- if ($OS -eq " linux" -or $OS -eq " darwin" ) {
138- Set-ItemProperty - Path $BIN - Name IsReadOnly - Value $false
139- Set-ItemProperty - Path $BIN - Name IsExecutable - Value $true
140- }
141-
142117 Write-Output " Adding Parseable to PATH..."
143118 # Only try adding to path if there isn't already a bun.exe in the path
144119 $Path = (Get-Env - Key " Path" ) -split ' ;'
0 commit comments