Skip to content

Commit

Permalink
fix: Code generation variable replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Its-treason committed Nov 20, 2024
1 parent 954b2b8 commit af37a49
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/bruno-core/src/codeGenerator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ export async function generateCode(
variables: {
process: {
process: {
// @ts-ignore
env: process.env
// @ts-expect-error `process.env` is a dict with weird typings
env: {
...process.env,
...collection.processEnvVariables
}
}
},
environment: environmentVariableRecord,
Expand Down
12 changes: 11 additions & 1 deletion packages/bruno-electron/src/ipc/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const { getPreferences } = require('../store/preferences');
const { getRequestFromCurlCommand } = require('../utils/curl');
const Watcher = require('../app/watcher');
const LastOpenedCollection = require('../store/last-opened-collections');
const { handleAuthorizationCodeInElectron } = require('../utils/handleAuthorizationCodeInElectron');

const environmentSecretsStore = new EnvironmentSecretsStore();

Expand Down Expand Up @@ -754,7 +755,16 @@ ipcMain.handle('renderer:delete-cookies-for-domain', async (event, domain) => {
});

ipcMain.handle('renderer:generate-code', async (event, item, collection, environment, globalVariables, options) => {
return await generateCode(item, collection, getPreferences(), cookieJar, options, environment, globalVariables);
return await generateCode(
item,
collection,
getPreferences(),
cookieJar,
options,
handleAuthorizationCodeInElectron,
environment,
globalVariables
);
});

ipcMain.handle('renderer:curl-to-request', async (event, curlString) => {
Expand Down

0 comments on commit af37a49

Please sign in to comment.