Class: Meroku::Secrets
- Inherits:
-
Object
- Object
- Meroku::Secrets
- Defined in:
- lib/meroku/secrets.rb
Overview
Logic related to api keys, passwords
Instance Attribute Summary collapse
-
#cached_aws_access_key_secret ⇒ Object
readonly
Returns the value of attribute cached_aws_access_key_secret.
-
#cached_private_key ⇒ Object
readonly
Returns the value of attribute cached_private_key.
-
#meroku_secret ⇒ Object
Returns the value of attribute meroku_secret.
Instance Method Summary collapse
- #aws_access_key ⇒ Object
- #aws_access_key_secret ⇒ Object
- #download_aws_access_key_secret ⇒ Object
- #download_private_key ⇒ Object
- #private_key ⇒ Object
Instance Attribute Details
#cached_aws_access_key_secret ⇒ Object (readonly)
Returns the value of attribute cached_aws_access_key_secret.
6 7 8 |
# File 'lib/meroku/secrets.rb', line 6 def cached_aws_access_key_secret @cached_aws_access_key_secret end |
#cached_private_key ⇒ Object (readonly)
Returns the value of attribute cached_private_key.
6 7 8 |
# File 'lib/meroku/secrets.rb', line 6 def cached_private_key @cached_private_key end |
#meroku_secret ⇒ Object
Returns the value of attribute meroku_secret.
7 8 9 |
# File 'lib/meroku/secrets.rb', line 7 def meroku_secret @meroku_secret end |
Instance Method Details
#aws_access_key ⇒ Object
9 10 11 |
# File 'lib/meroku/secrets.rb', line 9 def aws_access_key 'AKIAIRTTOJ2NSX27XWFA' end |
#aws_access_key_secret ⇒ Object
13 14 15 16 17 |
# File 'lib/meroku/secrets.rb', line 13 def aws_access_key_secret return @cached_aws_access_key_secret if @cached_aws_access_key_secret @cached_aws_access_key_secret = download_aws_access_key_secret @cached_aws_access_key_secret end |
#download_aws_access_key_secret ⇒ Object
19 20 21 22 23 24 |
# File 'lib/meroku/secrets.rb', line 19 def download_aws_access_key_secret bucket = "http://s3.amazonaws.com/#{@meroku_secret}/" uri = URI("#{bucket}aws_access_key_secret") @cached_aws_access_key_secret = Net::HTTP.get(uri).chomp @cached_aws_access_key_secret end |
#download_private_key ⇒ Object
32 33 34 35 36 |
# File 'lib/meroku/secrets.rb', line 32 def download_private_key uri = URI("http://s3.amazonaws.com/#{@meroku_secret}/meroku.id_rsa") @cached_private_key = Net::HTTP.get(uri).chomp @cached_private_key end |
#private_key ⇒ Object
26 27 28 29 30 |
# File 'lib/meroku/secrets.rb', line 26 def private_key return @cached_private_key if @cached_private_key @cached_private_key = download_private_key @cached_private_key end |