class S3Backup::Config

Attributes

aws_access_key_id[RW]
aws_endpoint[RW]
aws_region[RW]
aws_secret_access_key[RW]
aws_server_side_encryption[RW]
aws_stub_responses[RW]
bucket[RW]
pg_host[RW]
pg_password[RW]
pg_user[RW]
redis_dump_path[RW]
s3_keep[RW]
s3_pg_path[RW]
s3_redis_path[RW]
tables[RW]

Public Class Methods

config(*args) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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