From db00a9699e3b12e5f1b79b55a4fd35c4e1dee163 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 22 Jul 2019 22:14:31 +0100 Subject: Replace hard-coded test values with properties --- src/repoList.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/repoList.cpp') diff --git a/src/repoList.cpp b/src/repoList.cpp index 51eb6b2..9fc2848 100644 --- a/src/repoList.cpp +++ b/src/repoList.cpp @@ -1,15 +1,29 @@ #include +#include #include "repoList.h" #include "repo.h" -GitFS::RepoList::RepoList(const Ice::PropertiesPtr &) +#include + +GitFS::RepoList::RepoList(const Ice::PropertiesPtr & p) : properties(p) { } +AdHocFormatter(RepoPropertyName, "GitFS.%?.%?"); + NetFS::VolumePrxPtr -GitFS::RepoList::connect(const ::std::string, const ::std::string, +GitFS::RepoList::connect(const ::std::string volume, const ::std::string auth, const ::Ice::Current & ice) { - return Ice::uncheckedCast(ice.adapter->addWithUUID(std::make_shared())); + if (volume.empty()) throw NetFS::ConfigError(); + + const auto propReader = std::bind(&Ice::Properties::getProperty, properties, + std::bind((std::string(*)(const std::string_view &, const std::string_view &)) + (&RepoPropertyName::get), volume, std::placeholders::_1)); + + if (propReader("gitdir").empty()) throw NetFS::ConfigError(); + if (propReader("authkey") != auth) throw NetFS::AuthError(); + return Ice::uncheckedCast( + ice.adapter->addWithUUID(std::make_shared(propReader))); } -- cgit v1.2.3