Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix(infra): deterministic env var ordering (#4893)

Shreyas86c0bb619d9f
diff --git a/aio_run.mjs b/aio_run.mjs
index 3dbe7141f..504942fd1 100644
--- a/aio_run.mjs
+++ b/aio_run.mjs
@@ -36,6 +36,7 @@ function runChildProcessWithPrefix(command, args, prefix) {
const envFileContent = Object.entries(process.env)
.filter(([env]) => env.startsWith("VITE_"))
+ .sort(([envA], [envB]) => envA.localeCompare(envB))
.map(([env, val]) => `${env}=${
(val.startsWith("\"") && val.endsWith("\""))
? val
diff --git a/packages/hoppscotch-selfhost-web/prod_run.mjs b/packages/hoppscotch-selfhost-web/prod_run.mjs
index 57a68a778..c50f54592 100755
--- a/packages/hoppscotch-selfhost-web/prod_run.mjs
+++ b/packages/hoppscotch-selfhost-web/prod_run.mjs
@@ -4,6 +4,7 @@ import fs from "fs"
const envFileContent = Object.entries(process.env)
.filter(([env]) => env.startsWith("VITE_"))
+ .sort(([envA], [envB]) => envA.localeCompare(envB))
.map(
([env, val]) =>
`${env}=${val.startsWith('"') && val.endsWith('"') ? val : `"${val}"`}`
diff --git a/packages/hoppscotch-sh-admin/prod_run.mjs b/packages/hoppscotch-sh-admin/prod_run.mjs
index d571aff55..12243f971 100755
--- a/packages/hoppscotch-sh-admin/prod_run.mjs
+++ b/packages/hoppscotch-sh-admin/prod_run.mjs
@@ -34,6 +34,7 @@ function runChildProcessWithPrefix(command, args, prefix) {
const envFileContent = Object.entries(process.env)
.filter(([env]) => env.startsWith('VITE_'))
+ .sort(([envA], [envB]) => envA.localeCompare(envB))
.map(
([env, val]) =>
`${env}=${val.startsWith('"') && val.endsWith('"') ? val : `"${val}"`}`