mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 02:27:39 +00:00
feat: added approval handling for metadata in replicate
This commit is contained in:
@@ -342,13 +342,29 @@ export const secretReplicationServiceFactory = ({
|
|||||||
.map((el) => ({ ...el, operation: SecretOperations.Create })); // rewrite update ops to create
|
.map((el) => ({ ...el, operation: SecretOperations.Create })); // rewrite update ops to create
|
||||||
|
|
||||||
const locallyUpdatedSecrets = sourceSecrets
|
const locallyUpdatedSecrets = sourceSecrets
|
||||||
.filter(
|
.filter(({ key, secretKey, secretValue, secretMetadata }) => {
|
||||||
({ key, secretKey, secretValue }) =>
|
const sourceSecretMetadataJson = JSON.stringify(
|
||||||
|
(secretMetadata ?? []).map((entry) => ({
|
||||||
|
key: entry.key,
|
||||||
|
value: entry.value
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
|
const destinationSecretMetadataJson = JSON.stringify(
|
||||||
|
(destinationLocalSecretsGroupedByKey[key]?.[0]?.secretMetadata ?? []).map((entry) => ({
|
||||||
|
key: entry.key,
|
||||||
|
value: entry.value
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
destinationLocalSecretsGroupedByKey[key]?.[0] &&
|
destinationLocalSecretsGroupedByKey[key]?.[0] &&
|
||||||
// if key or value changed
|
// if key or value changed
|
||||||
(destinationLocalSecretsGroupedByKey[key]?.[0]?.secretKey !== secretKey ||
|
(destinationLocalSecretsGroupedByKey[key]?.[0]?.secretKey !== secretKey ||
|
||||||
destinationLocalSecretsGroupedByKey[key]?.[0]?.secretValue !== secretValue)
|
destinationLocalSecretsGroupedByKey[key]?.[0]?.secretValue !== secretValue ||
|
||||||
)
|
sourceSecretMetadataJson !== destinationSecretMetadataJson)
|
||||||
|
);
|
||||||
|
})
|
||||||
.map((el) => ({ ...el, operation: SecretOperations.Update })); // rewrite update ops to create
|
.map((el) => ({ ...el, operation: SecretOperations.Update })); // rewrite update ops to create
|
||||||
|
|
||||||
const locallyDeletedSecrets = destinationLocalSecrets
|
const locallyDeletedSecrets = destinationLocalSecrets
|
||||||
|
|||||||
Reference in New Issue
Block a user