From 386bb453d47c45ef7bfa7a7bcfa6da463cf25c56 Mon Sep 17 00:00:00 2001 From: nivedin Date: Wed, 21 Feb 2024 18:02:57 +0530 Subject: [PATCH] refactor: update environment variables precedence order --- packages/hoppscotch-common/src/helpers/RequestRunner.ts | 4 ++-- packages/hoppscotch-common/src/helpers/preRequest.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/hoppscotch-common/src/helpers/RequestRunner.ts b/packages/hoppscotch-common/src/helpers/RequestRunner.ts index 2b57fb3d7..8469b24b8 100644 --- a/packages/hoppscotch-common/src/helpers/RequestRunner.ts +++ b/packages/hoppscotch-common/src/helpers/RequestRunner.ts @@ -71,14 +71,14 @@ const getTestableBody = ( const combineEnvVariables = (variables: { environments: { - global: Environment["variables"] selected: Environment["variables"] + global: Environment["variables"] } requestVariables: Environment["variables"] }) => [ ...variables.requestVariables, - ...variables.environments.global, ...variables.environments.selected, + ...variables.environments.global, ] export const executedResponses$ = new Subject< diff --git a/packages/hoppscotch-common/src/helpers/preRequest.ts b/packages/hoppscotch-common/src/helpers/preRequest.ts index 562ffaefc..611536c5b 100644 --- a/packages/hoppscotch-common/src/helpers/preRequest.ts +++ b/packages/hoppscotch-common/src/helpers/preRequest.ts @@ -14,8 +14,8 @@ import { SecretEnvironmentService } from "~/services/secret-environment.service" const secretEnvironmentService = getService(SecretEnvironmentService) const unsecretEnvironments = ( - global: Environment["variables"], - selected: Environment + selected: Environment, + global: Environment["variables"] ) => { const resolvedGlobalWithSecrets = global.map((globalVar, index) => { const secretVar = secretEnvironmentService.getSecretEnvironmentVariable( @@ -65,8 +65,8 @@ const unsecretEnvironments = ( export const getCombinedEnvVariables = () => { const reformedVars = unsecretEnvironments( - getGlobalVariables(), - getCurrentEnvironment() + getCurrentEnvironment(), + getGlobalVariables() ) return { global: cloneDeep(reformedVars.global),