Class: ClusterFuck::CredentialGrabber
- Inherits:
-
Object
- Object
- ClusterFuck::CredentialGrabber
- Defined in:
- lib/cluster-fuck/credential_grabber.rb
Constant Summary collapse
- FOG_PATH =
"~/.fog"
- CF_PATH =
"~/.cluster-fuck"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find ⇒ Object
7 8 9 |
# File 'lib/cluster-fuck/credential_grabber.rb', line 7 def self.find new.find end |
Instance Method Details
#find ⇒ Object
11 12 13 |
# File 'lib/cluster-fuck/credential_grabber.rb', line 11 def find from_cluster_fuck_file || from_fog_file end |
#from_cluster_fuck_file ⇒ Object
27 28 29 30 31 |
# File 'lib/cluster-fuck/credential_grabber.rb', line 27 def from_cluster_fuck_file if exists?(CF_PATH) YAML.load_file(CF_PATH) end end |
#from_fog_file ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cluster-fuck/credential_grabber.rb', line 15 def from_fog_file if exists?(File.(FOG_PATH)) fog_credentials = YAML.load_file(File.(FOG_PATH)) { access_key_id: fog_credentials[:default][:aws_access_key_id], secret_access_key: fog_credentials[:default][:aws_secret_access_key], } end rescue ArgumentError #when there is no HOME, File.expand_path above raises ArgumentError nil end |