Class: AwsDockerUtils::AwsConfigStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_docker_utils/aws_config_storage.rb

Constant Summary collapse

CONFIG_FILE_PATH =
"./aws_docker_utils.yml"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAwsConfigStorage

Returns a new instance of AwsConfigStorage.



10
11
12
# File 'lib/aws_docker_utils/aws_config_storage.rb', line 10

def initialize
  self.config = fetch_config
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



6
7
8
# File 'lib/aws_docker_utils/aws_config_storage.rb', line 6

def config
  @config
end

Instance Method Details

#clear!Object



18
19
20
# File 'lib/aws_docker_utils/aws_config_storage.rb', line 18

def clear!
  `echo "# AWS credentials:" > #{file_name}`
end

#persist!(key, value) ⇒ Object



14
15
16
# File 'lib/aws_docker_utils/aws_config_storage.rb', line 14

def persist!(key, value)
  `echo '#{key}: "#{value}"' >> #{file_name}`
end

#valid?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/aws_docker_utils/aws_config_storage.rb', line 22

def valid?
  @config && @config.fetch('access_key') && @config.fetch('secret_key')
end