mirror of
https://github.com/usebruno/bruno.git
synced 2025-08-08 07:55:26 +02:00
Support for Collection Variables --------- Co-authored-by: lohit <lohit.jiddimani@gmail.com> Co-authored-by: lohit <lohxt.space@gmail.com>
30 lines
621 B
JavaScript
30 lines
621 B
JavaScript
const { interpolate } = require('@usebruno/common');
|
|
|
|
const interpolateString = (
|
|
str,
|
|
{ envVariables = {}, runtimeVariables = {}, processEnvVars = {}, collectionVariables = {}, folderVariables = {}, requestVariables = {} }
|
|
) => {
|
|
if (!str || !str.length || typeof str !== 'string') {
|
|
return str;
|
|
}
|
|
|
|
const combinedVars = {
|
|
...collectionVariables,
|
|
...envVariables,
|
|
...folderVariables,
|
|
...requestVariables,
|
|
...runtimeVariables,
|
|
process: {
|
|
env: {
|
|
...processEnvVars
|
|
}
|
|
}
|
|
};
|
|
|
|
return interpolate(str, combinedVars);
|
|
};
|
|
|
|
module.exports = {
|
|
interpolateString
|
|
};
|