mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 11:29:42 +00:00
feat: review nits and changes in loading
This commit is contained in:
@@ -671,10 +671,10 @@ export const RAW_SECRETS = {
|
||||
workspaceId: "The ID of the project where the secret is located."
|
||||
},
|
||||
GET_REFERENCE_TREE: {
|
||||
secretName: "The name of the secret to get.",
|
||||
workspaceId: "The ID of the project to get the secret from.",
|
||||
environment: "The slug of the environment to get the secret from.",
|
||||
secretPath: "The path of the secret to get."
|
||||
secretName: "The name of the secret to get the reference tree for.'.",
|
||||
workspaceId: "The ID of the project where the secret is located.",
|
||||
environment: "The slug of the environment where the the secret is located.",
|
||||
secretPath: "The folder path where the secret is located."
|
||||
}
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -446,10 +446,10 @@ export const expandSecretReferencesFactory = ({
|
||||
// eslint-disable-next-line no-continue
|
||||
if (!entities.length) continue;
|
||||
|
||||
let referredSecretPath = "";
|
||||
let referredSecretKey = "";
|
||||
let referredSecretEnvironmentSlug = "";
|
||||
let referredSecretValue = "";
|
||||
let referrencedSecretPath = "";
|
||||
let referencedSecretKey = "";
|
||||
let referencedSecretEnvironmentSlug = "";
|
||||
let referencedSecretValue = "";
|
||||
|
||||
if (entities.length === 1) {
|
||||
const [secretKey] = entities;
|
||||
@@ -464,10 +464,10 @@ export const expandSecretReferencesFactory = ({
|
||||
const cacheKey = getCacheUniqueKey(environment, secretPath);
|
||||
secretCache[cacheKey][secretKey] = referredValue;
|
||||
|
||||
referredSecretValue = referredValue.value;
|
||||
referredSecretKey = secretKey;
|
||||
referredSecretPath = secretPath;
|
||||
referredSecretEnvironmentSlug = environment;
|
||||
referencedSecretValue = referredValue.value;
|
||||
referencedSecretKey = secretKey;
|
||||
referrencedSecretPath = secretPath;
|
||||
referencedSecretEnvironmentSlug = environment;
|
||||
} else {
|
||||
const secretReferenceEnvironment = entities[0];
|
||||
const secretReferencePath = path.join("/", ...entities.slice(1, entities.length - 1));
|
||||
@@ -483,23 +483,23 @@ export const expandSecretReferencesFactory = ({
|
||||
const cacheKey = getCacheUniqueKey(secretReferenceEnvironment, secretReferencePath);
|
||||
secretCache[cacheKey][secretReferenceKey] = referedValue;
|
||||
|
||||
referredSecretValue = referedValue.value;
|
||||
referredSecretKey = secretReferenceKey;
|
||||
referredSecretPath = secretReferencePath;
|
||||
referredSecretEnvironmentSlug = secretReferenceEnvironment;
|
||||
referencedSecretValue = referedValue.value;
|
||||
referencedSecretKey = secretReferenceKey;
|
||||
referrencedSecretPath = secretReferencePath;
|
||||
referencedSecretEnvironmentSlug = secretReferenceEnvironment;
|
||||
}
|
||||
|
||||
const node = {
|
||||
value: referredSecretValue,
|
||||
secretPath: referredSecretPath,
|
||||
environment: referredSecretEnvironmentSlug,
|
||||
value: referencedSecretValue,
|
||||
secretPath: referrencedSecretPath,
|
||||
environment: referencedSecretEnvironmentSlug,
|
||||
depth: depth + 1,
|
||||
trace
|
||||
};
|
||||
|
||||
const shouldExpandMore = INTERPOLATION_SYNTAX_REG.test(referredSecretValue);
|
||||
const shouldExpandMore = INTERPOLATION_SYNTAX_REG.test(referencedSecretValue);
|
||||
if (dto.shouldStackTrace) {
|
||||
const stackTraceNode = { ...node, children: [], key: referredSecretKey, trace: null };
|
||||
const stackTraceNode = { ...node, children: [], key: referencedSecretKey, trace: null };
|
||||
trace?.children.push(stackTraceNode);
|
||||
// if stack trace this would be child node
|
||||
if (shouldExpandMore) {
|
||||
@@ -510,8 +510,8 @@ export const expandSecretReferencesFactory = ({
|
||||
stack.push(node);
|
||||
}
|
||||
|
||||
if (referredSecretValue) {
|
||||
expandedValue = expandedValue.replaceAll(interpolationSyntax, referredSecretValue);
|
||||
if (referencedSecretValue) {
|
||||
expandedValue = expandedValue.replaceAll(interpolationSyntax, referencedSecretValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,7 +1105,7 @@ export const secretServiceFactory = ({
|
||||
|
||||
if (!shouldUseSecretV2Bridge)
|
||||
throw new BadRequestError({
|
||||
message: "Project version doesn't not support secret reference tree",
|
||||
message: "Project version does not support secret reference tree",
|
||||
name: "SecretReferenceTreeNotSupported"
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user