fgerlits commented on code in PR #1915:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1915#discussion_r1963566505


##########
libminifi/include/core/ParameterProvider.h:
##########
@@ -65,16 +65,23 @@ class ParameterProvider : public ConfigurableComponentImpl, 
public CoreComponent
   MINIFIAPI static constexpr auto SensitiveParameterList = 
core::PropertyDefinitionBuilder<>::createProperty("Sensitive Parameter List")
       .withDescription("List of sensitive parameters, if 'Sensitive Parameter 
Scope' is set to 'selected'.")
       .build();
+  MINIFIAPI static constexpr auto ReloadValuesOnRestart = 
core::PropertyDefinitionBuilder<>::createProperty("Reload Values On Restart")
+      .withDescription("Reload provider generated parameter context values on 
restart")

Review Comment:
   minor improvement (add hyphen, clarify what 'restart' means):
   ```suggestion
         .withDescription("Reload provider-generated parameter context values 
when MiNiFi is restarted")
   ```



##########
libminifi/test/unit/JsonFlowSerializerTests.cpp:
##########
@@ -901,4 +901,93 @@ TEST_CASE("Parameter provider generated parameter context 
is not serialized if p
   }
 }
 
+TEST_CASE("Parameter provider generated parameter context is reserialized if 
Reload Values On Restart is set to true") {
+  ConfigurationTestController test_controller;
+  auto configuration_context = test_controller.getContext();
+  configuration_context.sensitive_values_encryptor = encryption_provider;
+  core::flow::AdaptiveConfiguration 
json_configuration_before{configuration_context};
+
+  const auto schema = core::flow::FlowSchema::getNiFiFlowJson();
+  static const std::string config_json_with_nifi_schema =
+      R"(
+{
+  "parameterProviders": [
+    {
+        "identifier": "d26ee5f5-0192-1000-0482-4e333725e089",
+        "name": "EnvironmentVariableParameterProvider",
+        "type": "EnvironmentVariableParameterProvider",
+        "properties": {
+          "Environment Variable Inclusion Strategy": "Comma-Separated",
+          "Include Environment Variables": "MINIFI_DATA,SECRET_MINIFI_DATA",
+          "Sensitive Parameter Scope": "selected",
+          "Sensitive Parameter List": "SECRET_MINIFI_DATA",
+          "Parameter Group Name": "environment-variable-parameter-context",
+          "Reload Values On Restart": "true"
+        }
+    }
+  ],
+  "parameterContexts": [
+    {
+        "identifier": "123ee5f5-0192-1000-0482-4e333725e345",
+        "name": "environment-variable-parameter-context",
+        "description": "my parameter context",
+        "parameters": [
+            {
+                "name": "SECRET_MINIFI_DATA",
+                "description": "",
+                "sensitive": true,
+                "provided": true,
+                "value": "old_secret_minifi_data_value"

Review Comment:
   This value would more realistically be 
`property_encryption::encrypt("old_secret_minifi_data_value", 
encryption_provider)`, right?  I think we could do that with a `fmt::format()`.
   
   If you want to leave it as it is for simplicity, that's fine, too, but then 
maybe change it to something like `"old_secret_minifi_data_value_encrypted"`.



##########
libminifi/src/core/json/JsonFlowSerializer.cpp:
##########
@@ -53,20 +53,11 @@ void 
JsonFlowSerializer::addProviderCreatedParameterContexts(rapidjson::Value& f
   }
 
   std::unordered_set<std::string> parameter_context_names;

Review Comment:
   `parameter_context_names` is unused, could be removed (in the YAML version, 
too)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to