1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

Allow parameters in store URIs

This is to allow store-specific configuration,
e.g. s3://my-cache?compression=bzip2&secret-key=/path/to/key.
This commit is contained in:
Eelco Dolstra 2016-04-29 16:26:16 +02:00
parent aa3bc3d5dc
commit 95d20dfde9
9 changed files with 56 additions and 8 deletions

View file

@ -16,6 +16,11 @@ public:
void init() override;
std::string getUri() override
{
return "file://" + binaryCacheDir;
}
protected:
bool fileExists(const std::string & path) override;
@ -78,7 +83,10 @@ ref<Store> openLocalBinaryCacheStore(std::shared_ptr<Store> localStore,
return store;
}
static RegisterStoreImplementation regStore([](const std::string & uri) -> std::shared_ptr<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("")),