lsst-git-lfs-s3 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/git-lfs-s3 +12 -0
- data/lib/git-lfs-s3.rb +3 -3
- data/lib/git-lfs-s3/application.rb +9 -9
- data/lib/git-lfs-s3/services/ceph_presigner.rb +4 -4
- data/lib/git-lfs-s3/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e5329df126cbda9ae4c2d57087112eb606fd122
|
4
|
+
data.tar.gz: 2bebe69bc7b1365b0de092ac70540277f377ae8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 922ef0899f0146774d03d4ac26aadefa7ed2ae1419a20b92bc4044a6fae4b8a95c134ef27d5db4d71125d03ebb963863ef2db56ecaaffaabf508565402e18243
|
7
|
+
data.tar.gz: efb4c65c139b9b478dd3ca930ae9cad5b709be4e98394245315377a1aaf877a8a18075c568064a32923ad4a29124b02d575793cbae06d175491e7956b8173392
|
data/bin/git-lfs-s3
CHANGED
@@ -11,8 +11,20 @@ GitLfsS3::Application.set :s3_bucket, ENV['S3_BUCKET']
|
|
11
11
|
GitLfsS3::Application.set :server_url, ENV['LFS_SERVER_URL']
|
12
12
|
GitLfsS3::Application.set :public_server, (ENV['LFS_PUBLIC_SERVER'] == 'true')
|
13
13
|
GitLfsS3::Application.set :ceph_s3, (ENV['LFS_CEPH_S3'] == 'true')
|
14
|
+
GitLfsS3::Application.set :endpoint, ENV['LFS_CEPH_ENDPOINT']
|
14
15
|
GitLfsS3::Application.set :logger, Logger.new(STDOUT)
|
15
16
|
|
17
|
+
if GitLfsS3::Application.settings.ceph_s3
|
18
|
+
Aws.config.update(
|
19
|
+
endpoint: ENV['LFS_CEPH_ENDPOINT'],
|
20
|
+
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
21
|
+
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
22
|
+
force_path_style: true,
|
23
|
+
region: 'us-east-1',
|
24
|
+
# ssl_ca_bundle: '/usr/local/etc/openssl/cert.pem' # Required for brew install on a mac.
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
16
28
|
GitLfsS3::Application.on_authenticate do |username, password, is_safe|
|
17
29
|
if is_safe # Whether the HTTP method is safe (GET, HEAD)
|
18
30
|
true
|
data/lib/git-lfs-s3.rb
CHANGED
@@ -35,7 +35,14 @@ module GitLfsS3
|
|
35
35
|
@auth.credentials[0], @auth.credentials[1], request.safe?
|
36
36
|
)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
|
+
def protected!
|
40
|
+
unless authorized?
|
41
|
+
response['WWW-Authenticate'] = %(Basic realm="Restricted Area")
|
42
|
+
throw(:halt, [401, "Invalid username or password"])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
39
46
|
get '/' do
|
40
47
|
"Git LFS S3 is online."
|
41
48
|
end
|
@@ -65,13 +72,6 @@ module GitLfsS3
|
|
65
72
|
body MultiJson.dump({message: 'Object not found'})
|
66
73
|
end
|
67
74
|
end
|
68
|
-
|
69
|
-
def protected!
|
70
|
-
unless authorized?
|
71
|
-
response['WWW-Authenticate'] = %(Basic realm="Restricted Area")
|
72
|
-
throw(:halt, [401, "Invalid username or password"])
|
73
|
-
end
|
74
|
-
end
|
75
75
|
|
76
76
|
def public_read_grant
|
77
77
|
grantee = Aws::S3::Types::Grantee.new(
|
@@ -93,7 +93,7 @@ module GitLfsS3
|
|
93
93
|
status service.status
|
94
94
|
body MultiJson.dump(service.response)
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
post '/verify', provides: 'application/vnd.git-lfs+json' do
|
98
98
|
data = MultiJson.load(request.body.tap { |b| b.rewind }.read)
|
99
99
|
object = object_data(data['oid'])
|
@@ -8,12 +8,12 @@ module GitLfsS3
|
|
8
8
|
module CephPresignerService
|
9
9
|
extend self
|
10
10
|
extend AwsHelpers
|
11
|
-
|
11
|
+
|
12
12
|
def signed_url(obj)
|
13
13
|
expire_at = (DateTime.now + 1).strftime("%s")
|
14
|
-
secret_access_key =
|
15
|
-
access_key_id =
|
16
|
-
endpoint =
|
14
|
+
secret_access_key = GitLfsS3::Application.settings.aws_secret_access_key
|
15
|
+
access_key_id = GitLfsS3::Application.settings.aws_access_key_id
|
16
|
+
endpoint = GitLfsS3::Application.settings.endpoint
|
17
17
|
digest = OpenSSL::Digest.new('sha1')
|
18
18
|
can_string = "PUT\n\napplication/octet-stream\n#{expire_at}\n/#{obj.bucket_name}/#{obj.key}"
|
19
19
|
hmac = OpenSSL::HMAC.digest(digest, secret_access_key, can_string)
|
data/lib/git-lfs-s3/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lsst-git-lfs-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan LeFevre
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-10-
|
12
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|