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
Branches
Tags
No related merge requests found
...@@ -105,9 +105,6 @@ private: ...@@ -105,9 +105,6 @@ private:
public: public:
InsecureCaosDBConnectionConfig(const std::string &host, int port); InsecureCaosDBConnectionConfig(const std::string &host, int port);
InsecureCaosDBConnectionConfig(
const std::string &host, int port,
const std::shared_ptr<Authenticator> &authenticator);
[[nodiscard]] auto getChannelCredentials() const [[nodiscard]] auto getChannelCredentials() const
-> std::shared_ptr<ChannelCredentials> override; -> std::shared_ptr<ChannelCredentials> override;
[[nodiscard]] auto toString() const -> std::string override; [[nodiscard]] auto toString() const -> std::string override;
......
...@@ -92,14 +92,6 @@ InsecureCaosDBConnectionConfig::InsecureCaosDBConnectionConfig( ...@@ -92,14 +92,6 @@ InsecureCaosDBConnectionConfig::InsecureCaosDBConnectionConfig(
this->credentials = InsecureChannelCredentials(); 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 auto InsecureCaosDBConnectionConfig::getChannelCredentials() const
-> std::shared_ptr<ChannelCredentials> { -> std::shared_ptr<ChannelCredentials> {
return this->credentials; return this->credentials;
...@@ -176,8 +168,9 @@ auto operator<<(std::ostream &out, const CaosDBConnection &connection) ...@@ -176,8 +168,9 @@ auto operator<<(std::ostream &out, const CaosDBConnection &connection)
case grpc::StatusCode::UNAVAILABLE: case grpc::StatusCode::UNAVAILABLE:
throw ConnectionError(status.error_message()); throw ConnectionError(status.error_message());
default: default:
std::cout << status.error_code() << "\n"; throw std::runtime_error("Status Code " +
throw std::runtime_error(status.error_message()); std::to_string(status.error_code()) + " - " +
status.error_message());
} }
} }
return std::make_unique<VersionInfo>(response.release_version_info()); return std::make_unique<VersionInfo>(response.release_version_info());
......
...@@ -29,20 +29,23 @@ ...@@ -29,20 +29,23 @@
#include "caosdb/authentication.h" #include "caosdb/authentication.h"
#include "caosdb/utils.h" #include "caosdb/utils.h"
#include "caosdb/info.h" #include "caosdb/info.h"
#include "caosdb/entity.h" // for Entity, EntityID
#include "caosdb/transaction.h" // for Transaction, UniqueResult
auto main() -> int { auto main() -> int {
std::cout << "CaosDB (libcaosdb " << caosdb::LIBCAOSDB_VERSION_MINOR << "." std::cout << "CaosDB (libcaosdb " << caosdb::LIBCAOSDB_VERSION_MINOR << "."
<< caosdb::LIBCAOSDB_VERSION_MINOR << "." << caosdb::LIBCAOSDB_VERSION_MINOR << "."
<< caosdb::LIBCAOSDB_VERSION_PATCH << ")" << std::endl; << caosdb::LIBCAOSDB_VERSION_PATCH << ")\n"
std::cout << "We don't miss the H of caos." << std::endl; << "We don't miss the H of caos.\n"
<< std::endl;
const auto pem_file = 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 = const auto host =
caosdb::utils::get_env_var("CAOSDB_SERVER_HOST", "localhost"); caosdb::utils::get_env_var("CAOSDB_SERVER_HOST", "localhost");
const auto port_str = 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 port = std::stoi(port_str);
const auto user = caosdb::utils::get_env_var("CAOSDB_USER", "admin"); const auto user = caosdb::utils::get_env_var("CAOSDB_USER", "admin");
const auto password = caosdb::utils::get_env_var("CAOSDB_PASSWORD", "caosdb"); 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.
Please register or to comment