serverless_redirector 0.3.4 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cec9e1e0836d7ba52eb371437e619193e7c7072
|
4
|
+
data.tar.gz: 888f20f1b64eb22675e8dfb577a6996992da6dd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4a20525b30514f0200ded81d9388b949f0f8b3be8b47023f476b6b24a0f0abe56321c095c011d15e0e0e75ab17dd2fb052d063ee095dade066a776d0a4ab5b
|
7
|
+
data.tar.gz: f2d691bf8169a3616b911972a24de11d88af8fddbfce2dcda0c05087b20092927868636cdd7f750354e3e97581b36077682f0b01dcc7f50fbaf8d0f52d5a76f6
|
@@ -15,7 +15,7 @@ module ServerlessRedirector
|
|
15
15
|
case operation
|
16
16
|
when ServerlessRedirector::Operations::RemoveRedirect
|
17
17
|
destination.remove_key operation.redirect.path
|
18
|
-
when ServerlessRedirector::Operations::CreateRedirect, ServerlessRedirector::Operations::
|
18
|
+
when ServerlessRedirector::Operations::CreateRedirect, ServerlessRedirector::Operations::UpdateDestination
|
19
19
|
rendered = ServerlessRedirector::Renderer.new('redirect.erb').render(url: operation.redirect.url)
|
20
20
|
destination.write_key operation.redirect.path, operation.redirect.url, rendered
|
21
21
|
end
|
@@ -102,7 +102,13 @@ module ServerlessRedirector
|
|
102
102
|
def bucket
|
103
103
|
@bucket ||= begin
|
104
104
|
client = Aws::S3::Client.new
|
105
|
-
region = @options['
|
105
|
+
region = @options['region'] || begin
|
106
|
+
constraint = ( || client).get_bucket_location(
|
107
|
+
bucket: bucket_name,
|
108
|
+
).location_constraint
|
109
|
+
|
110
|
+
normalise_constraint_to_region(constraint)
|
111
|
+
end
|
106
112
|
|
107
113
|
accelerate = @options['accelerate'] == "true"
|
108
114
|
|
@@ -115,6 +121,17 @@ module ServerlessRedirector
|
|
115
121
|
end
|
116
122
|
end
|
117
123
|
|
124
|
+
def normalise_constraint_to_region(constraint)
|
125
|
+
case constraint
|
126
|
+
when '', nil
|
127
|
+
'us-east-1'
|
128
|
+
when 'EU'
|
129
|
+
'eu-west-1'
|
130
|
+
else
|
131
|
+
constraint
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
118
135
|
def build_path(path)
|
119
136
|
if prefix
|
120
137
|
::File.join prefix, path
|