Class: S3Backup::Config
- Inherits:
-
Object
- Object
- S3Backup::Config
- Defined in:
- lib/s3_backup/config.rb
Class Attribute Summary collapse
-
.aws_access_key_id ⇒ Object
Returns the value of attribute aws_access_key_id.
-
.aws_endpoint ⇒ Object
Returns the value of attribute aws_endpoint.
-
.aws_region ⇒ Object
Returns the value of attribute aws_region.
-
.aws_secret_access_key ⇒ Object
Returns the value of attribute aws_secret_access_key.
-
.aws_server_side_encryption ⇒ Object
Returns the value of attribute aws_server_side_encryption.
-
.aws_stub_responses ⇒ Object
Returns the value of attribute aws_stub_responses.
-
.bucket ⇒ Object
Returns the value of attribute bucket.
-
.pg_host ⇒ Object
Returns the value of attribute pg_host.
-
.pg_password ⇒ Object
Returns the value of attribute pg_password.
-
.pg_user ⇒ Object
Returns the value of attribute pg_user.
-
.redis_dump_path ⇒ Object
Returns the value of attribute redis_dump_path.
-
.s3_keep ⇒ Object
Returns the value of attribute s3_keep.
-
.s3_pg_path ⇒ Object
Returns the value of attribute s3_pg_path.
-
.s3_redis_path ⇒ Object
Returns the value of attribute s3_redis_path.
-
.tables ⇒ Object
Returns the value of attribute tables.
Class Method Summary collapse
Class Attribute Details
.aws_access_key_id ⇒ Object
Returns the value of attribute aws_access_key_id.
13 14 15 |
# File 'lib/s3_backup/config.rb', line 13 def aws_access_key_id @aws_access_key_id end |
.aws_endpoint ⇒ Object
Returns the value of attribute aws_endpoint.
15 16 17 |
# File 'lib/s3_backup/config.rb', line 15 def aws_endpoint @aws_endpoint end |
.aws_region ⇒ Object
Returns the value of attribute aws_region.
18 19 20 |
# File 'lib/s3_backup/config.rb', line 18 def aws_region @aws_region end |
.aws_secret_access_key ⇒ Object
Returns the value of attribute aws_secret_access_key.
14 15 16 |
# File 'lib/s3_backup/config.rb', line 14 def aws_secret_access_key @aws_secret_access_key end |
.aws_server_side_encryption ⇒ Object
Returns the value of attribute aws_server_side_encryption.
16 17 18 |
# File 'lib/s3_backup/config.rb', line 16 def aws_server_side_encryption @aws_server_side_encryption end |
.aws_stub_responses ⇒ Object
Returns the value of attribute aws_stub_responses.
19 20 21 |
# File 'lib/s3_backup/config.rb', line 19 def aws_stub_responses @aws_stub_responses end |
.bucket ⇒ Object
Returns the value of attribute bucket.
17 18 19 |
# File 'lib/s3_backup/config.rb', line 17 def bucket @bucket end |
.pg_host ⇒ Object
Returns the value of attribute pg_host.
9 10 11 |
# File 'lib/s3_backup/config.rb', line 9 def pg_host @pg_host end |
.pg_password ⇒ Object
Returns the value of attribute pg_password.
11 12 13 |
# File 'lib/s3_backup/config.rb', line 11 def pg_password @pg_password end |
.pg_user ⇒ Object
Returns the value of attribute pg_user.
10 11 12 |
# File 'lib/s3_backup/config.rb', line 10 def pg_user @pg_user end |
.redis_dump_path ⇒ Object
Returns the value of attribute redis_dump_path.
12 13 14 |
# File 'lib/s3_backup/config.rb', line 12 def redis_dump_path @redis_dump_path end |
.s3_keep ⇒ Object
Returns the value of attribute s3_keep.
22 23 24 |
# File 'lib/s3_backup/config.rb', line 22 def s3_keep @s3_keep end |
.s3_pg_path ⇒ Object
Returns the value of attribute s3_pg_path.
20 21 22 |
# File 'lib/s3_backup/config.rb', line 20 def s3_pg_path @s3_pg_path end |
.s3_redis_path ⇒ Object
Returns the value of attribute s3_redis_path.
21 22 23 |
# File 'lib/s3_backup/config.rb', line 21 def s3_redis_path @s3_redis_path end |
.tables ⇒ Object
Returns the value of attribute tables.
23 24 25 |
# File 'lib/s3_backup/config.rb', line 23 def tables @tables end |
Class Method Details
.config(*args) ⇒ Object
58 59 60 61 62 |
# File 'lib/s3_backup/config.rb', line 58 def config(*args) args.inject(@configuration) do |hash, key| (hash.is_a?(Hash) && hash[key]) || nil end end |
.load!(file_path) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/s3_backup/config.rb', line 25 def load!(file_path) template = ERB.new File.new(file_path).read @configuration = YAML.load(template.result(binding)) self.pg_host = config('pg_database', 'host') self.pg_user = config('pg_database', 'user') self.pg_password = config('pg_database', 'password') self.redis_dump_path = config('redis', 'dump_path') self.aws_access_key_id = config('s3', 'aws_access_key_id') self.aws_secret_access_key = config('s3', 'aws_secret_access_key') self.bucket = config('s3', 'bucket') self.aws_region = config('s3', 'aws_region') self.aws_endpoint = config('s3', 'aws_endpoint') self.aws_server_side_encryption = config('s3', 'server_side_encryption') self.aws_stub_responses = config('s3', 'stub_responses') self.s3_keep = config('s3', 'keep') self.s3_pg_path = config('s3', 'pg_path') self.s3_redis_path = config('s3', 'redis_path') self.tables = config('tables') || {} true end |
.requires!(*args) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/s3_backup/config.rb', line 51 def requires!(*args) args.each do |argv| raise "Configuration missing: #{argv}" unless Config.send(argv) end true end |