From 533519b3434bc9278540fe7c69ff680d8c7a8c1c Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Tue, 3 Mar 2026 19:43:55 +0530 Subject: [PATCH] refactor: enhance version display logic in installation scripts to read from .env file --- docker/scripts/install.ps1 | 3 ++- docker/scripts/install.sh | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docker/scripts/install.ps1 b/docker/scripts/install.ps1 index d4a1598b4..61089f93a 100644 --- a/docker/scripts/install.ps1 +++ b/docker/scripts/install.ps1 @@ -314,7 +314,8 @@ Y88b d88P Y88b 888 888 888 Y88b d88P Y8b. 888 888 X88 Y8b. "@ -ForegroundColor White -$versionDisplay = if ($env:SURFSENSE_VERSION -and $env:SURFSENSE_VERSION -ne "latest") { "v$env:SURFSENSE_VERSION" } else { "latest" } +$versionDisplay = (Get-Content $envPath | Select-String '^SURFSENSE_VERSION=' | ForEach-Object { ($_ -split '=',2)[1].Trim('"') }) | Select-Object -First 1 +if (-not $versionDisplay) { $versionDisplay = "latest" } Write-Host " Your personal AI-powered search engine [$versionDisplay]" -ForegroundColor Yellow Write-Host ("=" * 62) -ForegroundColor Cyan Write-Host "" diff --git a/docker/scripts/install.sh b/docker/scripts/install.sh index 74697a454..f7729be00 100644 --- a/docker/scripts/install.sh +++ b/docker/scripts/install.sh @@ -299,11 +299,8 @@ Y88b d88P Y88b 888 888 888 Y88b d88P Y8b. 888 888 X88 Y8b. EOF -if [[ "${SURFSENSE_VERSION:-latest}" == "latest" ]]; then - _version_display="latest" -else - _version_display="v${SURFSENSE_VERSION}" -fi +_version_display=$(grep '^SURFSENSE_VERSION=' "${INSTALL_DIR}/.env" 2>/dev/null | cut -d= -f2 | tr -d '"' | head -1 || true) +_version_display="${_version_display:-latest}" printf " Your personal AI-powered search engine ${YELLOW}[%s]${NC}\n" "${_version_display}" printf "${CYAN}══════════════════════════════════════════════════════════════${NC}\n\n"