about summary refs log tree commit diff
path: root/src/libstore/local-binary-cache-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-29T14·47+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-29T14·47+0200
commit8e065c6b3e36e4cd113769575c0045b6d42357ef (patch)
tree9c1bf94731cdcb7c6b88bb6338379a7dd75d4475 /src/libstore/local-binary-cache-store.cc
parentf6aee2f4772b2de1943aaa2c40f8fb6dd3185b92 (diff)
BinaryCacheStore: Make the signing key a parameter
Diffstat (limited to 'src/libstore/local-binary-cache-store.cc')
-rw-r--r--src/libstore/local-binary-cache-store.cc29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index 2ec9a0d1045c..b6e72b039215 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -12,7 +12,11 @@ private:
 public:
 
     LocalBinaryCacheStore(std::shared_ptr<Store> localStore,
-        const Path & secretKeyFile, const Path & binaryCacheDir);
+        const StoreParams & params, const Path & binaryCacheDir)
+        : BinaryCacheStore(localStore, params)
+        , binaryCacheDir(binaryCacheDir)
+    {
+    }
 
     void init() override;
 
@@ -31,13 +35,6 @@ protected:
 
 };
 
-LocalBinaryCacheStore::LocalBinaryCacheStore(std::shared_ptr<Store> localStore,
-    const Path & secretKeyFile, const Path & binaryCacheDir)
-    : BinaryCacheStore(localStore, secretKeyFile)
-    , binaryCacheDir(binaryCacheDir)
-{
-}
-
 void LocalBinaryCacheStore::init()
 {
     createDirs(binaryCacheDir + "/nar");
@@ -74,23 +71,15 @@ std::shared_ptr<std::string> LocalBinaryCacheStore::getFile(const std::string &
     }
 }
 
-ref<Store> openLocalBinaryCacheStore(std::shared_ptr<Store> localStore,
-    const Path & secretKeyFile, const Path & binaryCacheDir)
-{
-    auto store = make_ref<LocalBinaryCacheStore>(
-        localStore, secretKeyFile, binaryCacheDir);
-    store->init();
-    return store;
-}
-
 static RegisterStoreImplementation regStore([](
     const std::string & uri, const StoreParams & params)
     -> std::shared_ptr<Store>
 {
     if (std::string(uri, 0, 7) != "file://") return 0;
-    return openLocalBinaryCacheStore(std::shared_ptr<Store>(0),
-        settings.get("binary-cache-secret-key-file", string("")),
-        std::string(uri, 7));
+    auto store = std::make_shared<LocalBinaryCacheStore>(
+        std::shared_ptr<Store>(0), params, std::string(uri, 7));
+    store->init();
+    return store;
 });
 
 }