swirl 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/swirl/ec2.rb +13 -4
- metadata +2 -2
data/lib/swirl/ec2.rb
CHANGED
@@ -21,13 +21,22 @@ module Swirl
|
|
21
21
|
|
22
22
|
def self.options(name=:default, file="~/.swirl")
|
23
23
|
file = File.expand_path(file)
|
24
|
-
|
25
|
-
|
24
|
+
config = YAML.load_file(file)
|
25
|
+
fail "Undefined account '#{name.inspect}'" if !config.has_key?(name)
|
26
|
+
config[name]
|
26
27
|
end
|
27
28
|
|
28
29
|
def initialize(options={}, file="~/.swirl")
|
29
|
-
|
30
|
-
|
30
|
+
|
31
|
+
if !File.exists?(file)
|
32
|
+
account = options[:account] || :default
|
33
|
+
options = self.class.options(account, file).merge(options)
|
34
|
+
elsif ENV["AWS_ACCESS_KEY_ID"] && ENV["AWS_SECRET_ACCESS_KEY"]
|
35
|
+
options[:aws_access_key_id] = ENV["AWS_ACCESS_KEY_ID"]
|
36
|
+
options[:aws_secret_access_key] = ENV["AWS_SECRET_ACCESS_KEY"]
|
37
|
+
else
|
38
|
+
fail "Credentials not set! See Swirl's README"
|
39
|
+
end
|
31
40
|
|
32
41
|
@aws_access_key_id = options[:aws_access_key_id]
|
33
42
|
@aws_secret_access_key = options[:aws_secret_access_key]
|