fix(common): environment variable mapping when referencing other variables (#5704)
This commit is contained in:
parent
6c2128fbed
commit
254eb3c958
2 changed files with 4 additions and 3 deletions
|
|
@ -63,7 +63,7 @@ const getCollectionSchema = (jsonStr: string): string | null => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const replacePMVarTemplating = flow(
|
export const replacePMVarTemplating = flow(
|
||||||
S.replace(/{{\s*/g, "<<"),
|
S.replace(/{{\s*/g, "<<"),
|
||||||
S.replace(/\s*}}/g, ">>")
|
S.replace(/\s*}}/g, ">>")
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { z } from "zod"
|
||||||
import { safeParseJSON } from "~/helpers/functional/json"
|
import { safeParseJSON } from "~/helpers/functional/json"
|
||||||
import { IMPORTER_INVALID_FILE_FORMAT } from "."
|
import { IMPORTER_INVALID_FILE_FORMAT } from "."
|
||||||
import { uniqueID } from "~/helpers/utils/uniqueID"
|
import { uniqueID } from "~/helpers/utils/uniqueID"
|
||||||
|
import { replacePMVarTemplating } from "./postman"
|
||||||
|
|
||||||
const postmanEnvSchema = z.object({
|
const postmanEnvSchema = z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
|
|
@ -56,8 +57,8 @@ export const postmanEnvImporter = (contents: string[]) => {
|
||||||
name,
|
name,
|
||||||
variables: values.map(({ key, value, type }) => ({
|
variables: values.map(({ key, value, type }) => ({
|
||||||
key,
|
key,
|
||||||
initialValue: value,
|
initialValue: replacePMVarTemplating(value),
|
||||||
currentValue: value,
|
currentValue: replacePMVarTemplating(value),
|
||||||
secret: type === "secret",
|
secret: type === "secret",
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue