Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GitLab
omnibus
Commits
52393d7c
Commit
52393d7c
authored
Aug 18, 2017
by
Seth Chisamore
Committed by
GitHub
Aug 18, 2017
Browse files
Merge pull request #797 from szechyjs/s3_path_style
Add config option to use path style S3 URLs
parents
f9446595
2795a39d
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/omnibus/config.rb
View file @
52393d7c
...
...
@@ -315,6 +315,11 @@ module Omnibus
# @return [String, nil]
default
(
:s3_endpoint
,
nil
)
# Use path style URLs instead of subdomains for S3 URLs
#
# @return [true, false]
default
(
:s3_force_path_style
,
false
)
# Enable or disable S3 Accelerate support
#
# @return [true, false]
...
...
lib/omnibus/s3_cache.rb
View file @
52393d7c
...
...
@@ -144,6 +144,7 @@ module Omnibus
bucket_name:
Config
.
s3_bucket
,
endpoint:
Config
.
s3_endpoint
,
use_accelerate_endpoint:
Config
.
s3_accelerate
,
force_path_style:
Config
.
s3_force_path_style
,
}
if
Config
.
s3_profile
...
...
lib/omnibus/s3_helpers.rb
View file @
52393d7c
...
...
@@ -38,6 +38,7 @@ module Omnibus
# bucket_name: Config.s3_bucket,
# endpoint: Config.s3_endpoint,
# use_accelerate_endpoint: Config.s3_accelerate
# force_path_style: Config.s3_force_path_style
# }
#
# @return [Hash<String, String>]
...
...
@@ -68,6 +69,7 @@ module Omnibus
def
resource_params
params
=
{
use_accelerate_endpoint:
s3_configuration
[
:use_accelerate_endpoint
],
force_path_style:
s3_configuration
[
:force_path_style
],
}
if
s3_configuration
[
:use_accelerate_endpoint
]
...
...
spec/unit/fetchers/net_fetcher_spec.rb
View file @
52393d7c
...
...
@@ -200,6 +200,17 @@ module Omnibus
end
end
context
"custom endpoint with path style urls"
do
before
do
Config
.
s3_force_path_style
(
true
)
Config
.
s3_endpoint
(
"http://example.com"
)
end
it
"returns the url using path style"
do
expect
(
subject
.
send
(
:download_url
)).
to
eq
(
"http://example.com/mybucket/file-1.2.3-abcd1234"
)
end
end
context
"s3 transfer acceleration"
do
before
{
Config
.
s3_accelerate
(
true
)
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment