INFRA-3591 | Dhruv | remove redactedValue while exporting manifest
This commit is contained in:
@@ -308,6 +308,18 @@ public class Manifest extends JsonEntity {
|
||||
setData("isDeployed", false);
|
||||
}
|
||||
|
||||
public void makeRedactedEnvironmentVariableValueNull() {
|
||||
if (environmentVariables == null) {
|
||||
return;
|
||||
}
|
||||
environmentVariables.forEach(secretConfig -> {
|
||||
if (redactedValueString.equals(secretConfig.getValue())) {
|
||||
secretConfig.setValue(null);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public void removeFieldsBeforeCopying(CloneManifestRequest cloneRequest) {
|
||||
setName(null);
|
||||
setEnvironment(null);
|
||||
@@ -412,11 +424,6 @@ public class Manifest extends JsonEntity {
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getType() {
|
||||
return (String) this.getData().get("type");
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public void setNamespace(String namespace) {
|
||||
if (deployment != null) {
|
||||
@@ -424,6 +431,11 @@ public class Manifest extends JsonEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getType() {
|
||||
return (String) this.getData().get("type");
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getTTL() {
|
||||
return metadata.getTtl();
|
||||
|
||||
@@ -880,6 +880,7 @@ public class ManifestService {
|
||||
"groupName");
|
||||
final Map keysToReplace = Map.of("isDeployed", false, "ids", emptyList());
|
||||
var manifest = version == null ? fetchById(id) : fetchByIdAndVersion(id, version);
|
||||
manifest.makeRedactedEnvironmentVariableValueNull();
|
||||
var manifestAsMap = manifest.convertToMap();
|
||||
ObjectTransformationUtil.removeKeys(manifestAsMap, keysToExclude);
|
||||
ObjectTransformationUtil.replaceKeys(manifestAsMap, keysToReplace);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
"name": "test_super_secret",
|
||||
"type": "SUPER_SECRET",
|
||||
"sha256": "ddfaa92ae32b9ff82c40ce5e3350f16de528f021727f13468d9b26201905f59a",
|
||||
"value": "*****"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
"name": "test_Config",
|
||||
"type": "SECRET",
|
||||
"sha256": "60303ae22b998861bce3b28f33eec1be758a213c86c93c076dbe9f558c11c752",
|
||||
"value": "*****"
|
||||
},
|
||||
{
|
||||
"name": "test_super_secret",
|
||||
"type": "SUPER_SECRET",
|
||||
"sha256": "ddfaa92ae32b9ff82c40ce5e3350f16de528f021727f13468d9b26201905f59a",
|
||||
"value": "*****"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user