diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js index 24655f4f0..68658f6ee 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js @@ -217,6 +217,19 @@ export const collectionsSlice = createSlice({ if (variable) { variable.value = value; + } else { + // __name__ is a private variable used to store the name of the environment + // this is not a user defined variable and hence should not be updated + if (key !== '__name__') { + activeEnvironment.variables.push({ + name: key, + value, + secret: false, + enabled: true, + type: 'text', + uid: uuid() + }); + } } }); } diff --git a/packages/bruno-js/src/bru.js b/packages/bruno-js/src/bru.js index 70139985f..ffab6ec1b 100644 --- a/packages/bruno-js/src/bru.js +++ b/packages/bruno-js/src/bru.js @@ -48,11 +48,6 @@ class Bru { throw new Error('Creating a env variable without specifying a name is not allowed.'); } - // gracefully ignore if key is not present in environment - if (!this.envVariables.hasOwnProperty(key)) { - return; - } - this.envVariables[key] = value; }