Skip to content

Commit 3d147c0

Browse files
committed
libstore: Implement getHumanReadableURI for S3BinaryCacheStoreConfig
This slightly improves the logs situation by including the region/profile/endpoint in the logs when S3 store references get printed. Instead of: copying path '/nix/store/lxnp9cs4cfh2g9r2bs4z7gwwz9kdj2r9-test-package-c' to 's3://bucketname'... This now includes: copying path '/nix/store/lxnp9cs4cfh2g9r2bs4z7gwwz9kdj2r9-test-package-c' to 's3://bucketname?endpoint=http://server:9000&region=eu-west-1'...
1 parent 61fbef4 commit 3d147c0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/libstore/include/nix/store/s3-binary-cache-store.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ struct S3BinaryCacheStoreConfig : HttpBinaryCacheStoreConfig
7575
static StringSet uriSchemes();
7676

7777
static std::string doc();
78+
79+
std::string getHumanReadableURI() const override;
7880
};
7981

8082
} // namespace nix

src/libstore/s3-binary-cache-store.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ S3BinaryCacheStoreConfig::S3BinaryCacheStoreConfig(
2929
}
3030
}
3131

32+
std::string S3BinaryCacheStoreConfig::getHumanReadableURI() const
33+
{
34+
auto reference = getReference();
35+
reference.params = [&]() {
36+
Params relevantParams;
37+
for (auto & setting : s3UriSettings)
38+
if (setting->overridden)
39+
relevantParams.insert({setting->name, reference.params.at(setting->name)});
40+
return relevantParams;
41+
}();
42+
return reference.render();
43+
}
44+
3245
std::string S3BinaryCacheStoreConfig::doc()
3346
{
3447
return R"(

0 commit comments

Comments
 (0)