mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 00:25:50 +00:00
Extracted duplicated regex pattern to a constant
This commit is contained in:
@@ -56,6 +56,7 @@ type TSecretImportSecretsV2 = {
|
|||||||
|
|
||||||
const LEVEL_BREAK = 10;
|
const LEVEL_BREAK = 10;
|
||||||
const getImportUniqKey = (envSlug: string, path: string) => `${envSlug}=${path}`;
|
const getImportUniqKey = (envSlug: string, path: string) => `${envSlug}=${path}`;
|
||||||
|
const RESERVED_IMPORT_REGEX = new RE2("/__reserve_replication_([a-f0-9-]{36})");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes reserved imports by resolving them to their replication source.
|
* Processes reserved imports by resolving them to their replication source.
|
||||||
@@ -75,7 +76,7 @@ const processReservedImports = async <
|
|||||||
|
|
||||||
imports.forEach((secretImport) => {
|
imports.forEach((secretImport) => {
|
||||||
if (secretImport.isReserved) {
|
if (secretImport.isReserved) {
|
||||||
const reservedMatch = new RE2("/__reserve_replication_([a-f0-9-]{36})").exec(secretImport.importPath);
|
const reservedMatch = RESERVED_IMPORT_REGEX.exec(secretImport.importPath);
|
||||||
if (reservedMatch) {
|
if (reservedMatch) {
|
||||||
const referencedImportId = reservedMatch[1];
|
const referencedImportId = reservedMatch[1];
|
||||||
reservedImportIds.push(referencedImportId);
|
reservedImportIds.push(referencedImportId);
|
||||||
@@ -107,7 +108,7 @@ const processReservedImports = async <
|
|||||||
|
|
||||||
return imports.map((secretImport) => {
|
return imports.map((secretImport) => {
|
||||||
if (secretImport.isReserved) {
|
if (secretImport.isReserved) {
|
||||||
const reservedMatch = new RE2("/__reserve_replication_([a-f0-9-]{36})").exec(secretImport.importPath);
|
const reservedMatch = RESERVED_IMPORT_REGEX.exec(secretImport.importPath);
|
||||||
if (reservedMatch) {
|
if (reservedMatch) {
|
||||||
const referencedImportId = reservedMatch[1];
|
const referencedImportId = reservedMatch[1];
|
||||||
const referencedDetails = importDetailsMap.get(referencedImportId);
|
const referencedDetails = importDetailsMap.get(referencedImportId);
|
||||||
|
|||||||
Reference in New Issue
Block a user