Class: LambdaDeployment::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



3
4
5
# File 'lib/lambda_deployment/configuration.rb', line 3

def file_path
  @file_path
end

#projectObject (readonly)

Returns the value of attribute project.



3
4
5
# File 'lib/lambda_deployment/configuration.rb', line 3

def project
  @project
end

#regionObject (readonly)

Returns the value of attribute region.



3
4
5
# File 'lib/lambda_deployment/configuration.rb', line 3

def region
  @region
end

#s3_bucketObject (readonly)

Returns the value of attribute s3_bucket.



3
4
5
# File 'lib/lambda_deployment/configuration.rb', line 3

def s3_bucket
  @s3_bucket
end

#s3_keyObject (readonly)

Returns the value of attribute s3_key.



3
4
5
# File 'lib/lambda_deployment/configuration.rb', line 3

def s3_key
  @s3_key
end

#s3_sseObject (readonly)

Returns the value of attribute s3_sse.



3
4
5
# File 'lib/lambda_deployment/configuration.rb', line 3

def s3_sse
  @s3_sse
end

Instance Method Details

#alias_nameObject



17
18
19
# File 'lib/lambda_deployment/configuration.rb', line 17

def alias_name
  ENV.fetch('TAG', nil)
end

#load_config(config_file) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/lambda_deployment/configuration.rb', line 5

def load_config(config_file)
  config = YAML.load_file(config_file)
  @project = config.fetch('project')
  @region = config.fetch('region', ENV.fetch('AWS_REGION', nil))
  @file_path = File.expand_path(config.fetch('file_name'), File.dirname(config_file))
  raise "File not found: #{@file_path}" unless File.exist?(@file_path)

  @s3_bucket = config.fetch('s3_bucket', ENV.fetch('LAMBDA_S3_BUCKET', nil))
  @s3_key = s3_key_name(config.fetch('file_name'))
  @s3_sse = config.fetch('s3_sse', ENV.fetch('LAMBDA_S3_SSE', nil))
end