Class: MongoBacker::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo_backer/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Configuration

Returns a new instance of Configuration.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mongo_backer/configuration.rb', line 5

def initialize(*args)
  unless args.empty?
    config = YAML.load_file(args[0])
    @host = config["mongo"]["host"]
    @port = config["mongo"]["port"]
    @mongodump = config["mongo"]["mongodump"]
    @access_key_id = config["s3"]["access_key_id"]
    @secret_access_key = config["s3"]["secret_access_key"]
    @bucket = config["s3"]["bucket"]
  end
  
  rescue Errno::ENOENT
    raise ArgumentError, "file not found at #{args[0]}"
    
end

Instance Attribute Details

#access_key_idObject

Returns the value of attribute access_key_id.



3
4
5
# File 'lib/mongo_backer/configuration.rb', line 3

def access_key_id
  @access_key_id
end

#bucketObject

Returns the value of attribute bucket.



3
4
5
# File 'lib/mongo_backer/configuration.rb', line 3

def bucket
  @bucket
end

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/mongo_backer/configuration.rb', line 3

def host
  @host
end

#mongodumpObject

Returns the value of attribute mongodump.



3
4
5
# File 'lib/mongo_backer/configuration.rb', line 3

def mongodump
  @mongodump
end

#portObject

Returns the value of attribute port.



3
4
5
# File 'lib/mongo_backer/configuration.rb', line 3

def port
  @port
end

#secret_access_keyObject

Returns the value of attribute secret_access_key.



3
4
5
# File 'lib/mongo_backer/configuration.rb', line 3

def secret_access_key
  @secret_access_key
end