Class: PgbackupsArchive::Storage
- Inherits:
-
Object
- Object
- PgbackupsArchive::Storage
- Defined in:
- lib/pgbackups-archive/storage.rb
Instance Method Summary collapse
- #bucket ⇒ Object
- #connection ⇒ Object
-
#initialize(key, file) ⇒ Storage
constructor
A new instance of Storage.
- #store ⇒ Object
Constructor Details
#initialize(key, file) ⇒ Storage
Returns a new instance of Storage.
6 7 8 9 |
# File 'lib/pgbackups-archive/storage.rb', line 6 def initialize(key, file) @key = key @file = file end |
Instance Method Details
#bucket ⇒ Object
21 22 23 |
# File 'lib/pgbackups-archive/storage.rb', line 21 def bucket connection.directories.get ENV["PGBACKUPS_BUCKET"] end |
#connection ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/pgbackups-archive/storage.rb', line 11 def connection Fog::Storage.new({ :provider => "AWS", :aws_access_key_id => ENV["PGBACKUPS_AWS_ACCESS_KEY_ID"], :aws_secret_access_key => ENV["PGBACKUPS_AWS_SECRET_ACCESS_KEY"], :region => ENV["PGBACKUPS_REGION"], :persistent => false }) end |
#store ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/pgbackups-archive/storage.rb', line 25 def store = {:key => @key, :body => @file, :public => false, :encryption => "AES256"} if ENV["PGBACKUPS_MULTIPART_CHUNK_SIZE"] .merge!(:multipart_chunk_size => ENV["PGBACKUPS_MULTIPART_CHUNK_SIZE"].to_i) end bucket.files.create() end |