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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ba5d40163f92542e7c934d5a755911f769d7903
4
- data.tar.gz: f77dd021ea75fc075007f80ad009c547f68956db
3
+ metadata.gz: 6e5329df126cbda9ae4c2d57087112eb606fd122
4
+ data.tar.gz: 2bebe69bc7b1365b0de092ac70540277f377ae8d
5
5
  SHA512:
6
- metadata.gz: 56dbf305a4b992ae9919139156aba41d85460bb4bcd2ccc1bbc0a3656f86372edb72cb9de233d20dc810bc0ae849abbcbc96fa40bc5900ec1fe455121cb4f032
7
- data.tar.gz: 69852595fa41ed2361c2044ec27275719c2185e6b89455c9889306b18c68159198743af93835cc79f16a001eef5a3979c0d8ef7cb518cf696d705384d5b4f9a5
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
@@ -1,6 +1,6 @@
1
- require "sinatra/base"
2
- require "aws-sdk"
3
- require "multi_json"
1
+ require 'sinatra/base'
2
+ require 'aws-sdk'
3
+ require 'multi_json'
4
4
 
5
5
  require "git-lfs-s3/aws"
6
6
  require "git-lfs-s3/services/upload"
@@ -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 = Aws.config[:secret_access_key]
15
- access_key_id = Aws.config[:access_key_id]
16
- endpoint = Aws.config[: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)
@@ -1,3 +1,3 @@
1
1
  module GitLfsS3
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
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.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-13 00:00:00.000000000 Z
12
+ date: 2015-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk