Class: Phase::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/phase/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/phase/configuration.rb', line 7

def initialize
  @bastions_enabled     = false
  @bastion_role         = nil
  @bastion_user         = nil
  @public_subnet_name   = "public"
  @private_subnet_name  = "private"
  @aws_region           = "us-east-1"
  @adapter              = ::Phase::Adapters::AWS

  self.backend = ::Phase::SSH::Backend
  set_aws_credentials!
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def adapter
  @adapter
end

#aws_regionObject

Returns the value of attribute aws_region.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def aws_region
  @aws_region
end

#backendObject

Returns the value of attribute backend.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def backend
  @backend
end

#bastion_roleObject

Returns the value of attribute bastion_role.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def bastion_role
  @bastion_role
end

#bastion_userObject

Returns the value of attribute bastion_user.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def bastion_user
  @bastion_user
end

#bastions_enabledObject

Returns the value of attribute bastions_enabled.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def bastions_enabled
  @bastions_enabled
end

#private_subnet_nameObject

Returns the value of attribute private_subnet_name.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def private_subnet_name
  @private_subnet_name
end

#public_subnet_nameObject

Returns the value of attribute public_subnet_name.



4
5
6
# File 'lib/phase/configuration.rb', line 4

def public_subnet_name
  @public_subnet_name
end

Instance Method Details

#deployObject



26
27
28
# File 'lib/phase/configuration.rb', line 26

def deploy
  @deploy ||= Config::Deploy.new
end

#ipaObject

See Also:



31
32
33
# File 'lib/phase/configuration.rb', line 31

def ipa
  @ipa ||= Config::IPA.new
end

#load_phasefile!Object



35
36
37
38
39
# File 'lib/phase/configuration.rb', line 35

def load_phasefile!
  if ::File.exist?(phasefile_path)
    load phasefile_path
  end
end

#set_aws_credentials!(access_key_id = nil, secret_access_key = nil) ⇒ Object



41
42
43
44
45
46
# File 'lib/phase/configuration.rb', line 41

def set_aws_credentials!(access_key_id = nil, secret_access_key = nil)
  Fog.credentials = {
    aws_access_key_id:     ENV.fetch('AWS_ACCESS_KEY_ID', access_key_id),
    aws_secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY', secret_access_key)
  }
end