Class: AwsDockerUtils::AwsConfigStorage
- Inherits:
-
Object
- Object
- AwsDockerUtils::AwsConfigStorage
- Defined in:
- lib/aws_docker_utils/aws_config_storage.rb
Constant Summary collapse
- CONFIG_FILE_PATH =
"./aws_docker_utils.yml"
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #clear! ⇒ Object
-
#initialize ⇒ AwsConfigStorage
constructor
A new instance of AwsConfigStorage.
- #persist!(key, value) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ AwsConfigStorage
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
#config ⇒ Object
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
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 |