File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -735,18 +735,17 @@ fs::path GetConfigFile(const std::string& confPath)
735735 return AbsPathForConfigVal (fs::path (confPath), false );
736736}
737737
738- void ArgsManager::ReadConfigFile ( const std::string& confPath )
738+ void ArgsManager::ReadConfigStream ( std::istream& stream )
739739{
740- fs::ifstream streamConfig (GetConfigFile (confPath));
741- if (!streamConfig.good ())
740+ if (!stream.good ())
742741 return ; // No bitcoin.conf file is OK
743742
744743 {
745744 LOCK (cs_args);
746745 std::set<std::string> setOptions;
747746 setOptions.insert (" *" );
748747
749- for (boost::program_options::detail::config_file_iterator it (streamConfig , setOptions), end; it != end; ++it)
748+ for (boost::program_options::detail::config_file_iterator it (stream , setOptions), end; it != end; ++it)
750749 {
751750 // Don't overwrite existing settings so command line settings override bitcoin.conf
752751 std::string strKey = std::string (" -" ) + it->string_key ;
@@ -757,6 +756,13 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
757756 mapMultiArgs[strKey].push_back (strValue);
758757 }
759758 }
759+ }
760+
761+ void ArgsManager::ReadConfigFile (const std::string& confPath)
762+ {
763+ fs::ifstream stream (GetConfigFile (confPath));
764+ ReadConfigStream (stream);
765+
760766 // If datadir is changed in .conf file:
761767 ClearDatadirCache ();
762768 if (!fs::is_directory (GetDataDir (false ))) {
Original file line number Diff line number Diff line change @@ -228,6 +228,8 @@ class ArgsManager
228228 std::map<std::string, std::vector<std::string>> mapMultiArgs;
229229 std::unordered_set<std::string> m_negated_args;
230230
231+ void ReadConfigStream (std::istream& stream);
232+
231233public:
232234 void ParseParameters (int argc, const char *const argv[]);
233235 void ReadConfigFile (const std::string& confPath);
You can’t perform that action at this time.
0 commit comments