From 5789eaa3f45cadec719b4f642de2169b8b0a56c4 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 3 Mar 2017 16:12:17 -0500 Subject: Add aws-region param to S3 store URLs --- src/libstore/s3-binary-cache-store.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/libstore/s3-binary-cache-store.cc') diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index 041c68c6816f..a110f5ade48d 100644 --- a/src/libstore/s3-binary-cache-store.cc +++ b/src/libstore/s3-binary-cache-store.cc @@ -52,8 +52,8 @@ static void initAWS() }); } -S3Helper::S3Helper() - : config(makeConfig()) +S3Helper::S3Helper(const string & region) + : config(makeConfig(region)) , client(make_ref(*config)) { } @@ -70,11 +70,11 @@ class RetryStrategy : public Aws::Client::DefaultRetryStrategy } }; -ref S3Helper::makeConfig() +ref S3Helper::makeConfig(const string & region) { initAWS(); auto res = make_ref(); - res->region = Aws::Region::US_EAST_1; // FIXME: make configurable + res->region = region; res->requestTimeoutMs = 600 * 1000; res->retryStrategy = std::make_shared(); return res; @@ -140,6 +140,7 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore const Params & params, const std::string & bucketName) : S3BinaryCacheStore(params) , bucketName(bucketName) + , s3Helper(get(params, "aws-region", Aws::Region::US_EAST_1)) { diskCache = getNarInfoDiskCache(); } -- cgit 1.4.1