15 std::string armarx_home = std::string(getenv(
"HOME")) +
"/.armarx";
16 if (getenv(
"ARMARX_DEFAULTS_DIR"))
18 armarx_home = getenv(
"ARMARX_DEFAULTS_DIR");
20 std::ifstream cFile(armarx_home +
"/default.cfg");
24 while (getline(cFile, line))
26 line.erase(std::remove_if(line.begin(), line.end(), isspace), line.end());
27 if (line[0] ==
'#' || line.empty())
31 auto delimiterPos = line.find(
"=");
32 const auto name = line.substr(0, delimiterPos);
33 const auto value = line.substr(delimiterPos + 1);
34 if (name ==
"ArmarX.MongoHost")
38 if (name ==
"ArmarX.MongoPort")
40 port = (
unsigned int)std::stoi(value);
42 if (name ==
"ArmarX.MongoUser")
46 if (name ==
"ArmarX.MongoPassword")
141 if (!forceNewConnection)
143 auto it = Connections.find(settings.
key());
144 if (it != Connections.end())
146 auto client = it->second->acquire();
147 auto admin =
client->database(
"admin");
148 auto result = admin.run_command(bsoncxx::builder::basic::make_document(
149 bsoncxx::builder::basic::kvp(
"isMaster", 1)));
154 mongocxx::uri uri(settings.
uri());
155 auto client = mongocxx::client(uri);
156 auto admin =
client[
"admin"];
157 auto result = admin.run_command(bsoncxx::builder::basic::make_document(
158 bsoncxx::builder::basic::kvp(
"isMaster", 1)));
161 catch (
const std::exception& xcp)