MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / loadConfigureFile

Method loadConfigureFile

libminifi/src/properties/Properties.cpp:70–92  ·  view source on GitHub ↗

Load Configure File

Source from the content-addressed store, hash-verified

68
69// Load Configure File
70void Properties::loadConfigureFile(const char *fileName) {
71 std::lock_guard<std::mutex> lock(mutex_);
72 if (fileName == nullptr) {
73 logger_->log_error("Configuration file path for %s is a nullptr!", getName().c_str());
74 return;
75 }
76
77 properties_file_ = utils::file::getFullPath(utils::file::FileUtils::concat_path(getHome(), fileName));
78
79 logger_->log_info("Using configuration file to load configuration for %s from %s (located at %s)",
80 getName().c_str(), fileName, properties_file_);
81
82 std::ifstream file(properties_file_, std::ifstream::in);
83 if (!file.good()) {
84 logger_->log_error("load configure file failed %s", properties_file_);
85 return;
86 }
87 properties_.clear();
88 for (const auto& line : PropertiesFile{file}) {
89 properties_[line.getKey()] = {utils::StringUtils::replaceEnvironmentVariables(line.getValue()), false};
90 }
91 dirty_ = false;
92}
93
94bool Properties::persistProperties() {
95 std::lock_guard<std::mutex> lock(mutex_);

Callers 5

mainFunction · 0.80
mainFunction · 0.80
DecryptorTests.cppFile · 0.80
createMethod · 0.80
getAWSCredentialsMethod · 0.80

Calls 8

getFullPathFunction · 0.85
log_errorMethod · 0.80
c_strMethod · 0.80
log_infoMethod · 0.80
concat_pathFunction · 0.50
clearMethod · 0.45
getKeyMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected