modules/mu/clouds/aws.rb in cloud-mu-2.0.0.pre.alpha7 vs modules/mu/clouds/aws.rb in cloud-mu-2.0.0.pre.alpha8

- old
+ new

@@ -146,11 +146,11 @@ # decide what our default region is. def self.myRegion return @@myRegion_var if @@myRegion_var return nil if credConfig.nil? and !hosted? - if $MU_CFG and (!$MU_CFG['aws'] or !account_number) and !hosted? + if $MU_CFG and (!$MU_CFG['aws'] or !account_number) and !hosted? and !ENV['EC2_REGION'] return nil end def self.validate_region(r) MU::Cloud::AWS.ec2(region: r).describe_availability_zones.availability_zones.first.region_name @@ -437,9 +437,16 @@ @@my_hosted_cfg = hosted_config return name_only ? "#default" : @@my_hosted_cfg end rescue JSON::ParserError => e end + elsif ENV['AWS_ACCESS_KEY'] and ENV['AWS_SECRET_ACCESS_KEY'] + env_config = { + "region" => ENV['EC2_REGION'] || "us-east-1", + "access_key" => ENV['AWS_ACCESS_KEY'], + "access_secret" => ENV['AWS_SECRET_ACCESS_KEY'] + } + return name_only ? "#default" : env_config end return nil end