Skip to content
Snippets Groups Projects
Verified Commit bfbfa7fd authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: retrieve simple entity

parent d1852b10
No related branches found
No related tags found
No related merge requests found
......@@ -105,9 +105,6 @@ private:
public:
InsecureCaosDBConnectionConfig(const std::string &host, int port);
InsecureCaosDBConnectionConfig(
const std::string &host, int port,
const std::shared_ptr<Authenticator> &authenticator);
[[nodiscard]] auto getChannelCredentials() const
-> std::shared_ptr<ChannelCredentials> override;
[[nodiscard]] auto toString() const -> std::string override;
......
......@@ -92,14 +92,6 @@ InsecureCaosDBConnectionConfig::InsecureCaosDBConnectionConfig(
this->credentials = InsecureChannelCredentials();
}
InsecureCaosDBConnectionConfig::InsecureCaosDBConnectionConfig(
const std::string &host, int port,
const std::shared_ptr<Authenticator> &authenticator)
: CaosDBConnectionConfig(host, port) {
this->credentials = grpc::CompositeChannelCredentials(
InsecureChannelCredentials(), authenticator->getCallCredentials());
}
auto InsecureCaosDBConnectionConfig::getChannelCredentials() const
-> std::shared_ptr<ChannelCredentials> {
return this->credentials;
......@@ -176,8 +168,9 @@ auto operator<<(std::ostream &out, const CaosDBConnection &connection)
case grpc::StatusCode::UNAVAILABLE:
throw ConnectionError(status.error_message());
default:
std::cout << status.error_code() << "\n";
throw std::runtime_error(status.error_message());
throw std::runtime_error("Status Code " +
std::to_string(status.error_code()) + " - " +
status.error_message());
}
}
return std::make_unique<VersionInfo>(response.release_version_info());
......
......@@ -29,20 +29,23 @@
#include "caosdb/authentication.h"
#include "caosdb/utils.h"
#include "caosdb/info.h"
#include "caosdb/entity.h" // for Entity, EntityID
#include "caosdb/transaction.h" // for Transaction, UniqueResult
auto main() -> int {
std::cout << "CaosDB (libcaosdb " << caosdb::LIBCAOSDB_VERSION_MINOR << "."
<< caosdb::LIBCAOSDB_VERSION_MINOR << "."
<< caosdb::LIBCAOSDB_VERSION_PATCH << ")" << std::endl;
std::cout << "We don't miss the H of caos." << std::endl;
<< caosdb::LIBCAOSDB_VERSION_PATCH << ")\n"
<< "We don't miss the H of caos.\n"
<< std::endl;
const auto pem_file =
caosdb::utils::get_env_var("CAOSDB_SERVER_CA_PEM", std::string());
caosdb::utils::get_env_var("CAOSDB_SERVER_CERT", std::string());
const auto host =
caosdb::utils::get_env_var("CAOSDB_SERVER_HOST", "localhost");
const auto port_str =
caosdb::utils::get_env_var("CAOSDB_SERVER_PORT", "8443");
caosdb::utils::get_env_var("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443");
const auto port = std::stoi(port_str);
const auto user = caosdb::utils::get_env_var("CAOSDB_USER", "admin");
const auto password = caosdb::utils::get_env_var("CAOSDB_PASSWORD", "caosdb");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment