mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-25 13:45:52 +00:00
31 lines
689 B
JavaScript
31 lines
689 B
JavaScript
const { interpolate } = require('@usebruno/common');
|
|
|
|
const interpolateString = (
|
|
str,
|
|
{ envVariables = {}, runtimeVariables = {}, processEnvVars = {}, collectionVariables = {}, folderVariables = {}, requestVariables = {}, globalEnvironmentVariables = {} }
|
|
) => {
|
|
if (!str || !str.length || typeof str !== 'string') {
|
|
return str;
|
|
}
|
|
|
|
const combinedVars = {
|
|
...globalEnvironmentVariables,
|
|
...collectionVariables,
|
|
...envVariables,
|
|
...folderVariables,
|
|
...requestVariables,
|
|
...runtimeVariables,
|
|
process: {
|
|
env: {
|
|
...processEnvVars
|
|
}
|
|
}
|
|
};
|
|
|
|
return interpolate(str, combinedVars);
|
|
};
|
|
|
|
module.exports = {
|
|
interpolateString
|
|
};
|