summaryrefslogtreecommitdiff
path: root/src/repoList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/repoList.cpp')
-rw-r--r--src/repoList.cpp20
1 files changed, 17 insertions, 3 deletions
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 <Ice/ObjectAdapter.h>
+#include <Ice/Properties.h>
#include "repoList.h"
#include "repo.h"
-GitFS::RepoList::RepoList(const Ice::PropertiesPtr &)
+#include <compileTimeFormatter.h>
+
+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<NetFS::VolumePrx>(ice.adapter->addWithUUID(std::make_shared<Repo>()));
+ 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<NetFS::VolumePrx>(
+ ice.adapter->addWithUUID(std::make_shared<Repo>(propReader)));
}