Class: AwsLambdaRIC::Bootstrap

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

Instance Method Summary collapse

Instance Method Details

#bootstrap_handlerObject



219
220
221
222
223
224
225
226
227
228
# File 'lib/aws_lambda_ric.rb', line 219

def bootstrap_handler
  if ENV['_HANDLER'] == nil
    puts 'No handler specified, exiting Runtime Interface Client.'
    exit
  end
  app_root = Dir.pwd
  handler = ENV['_HANDLER']
  lambda_runner = AwsLambdaRIC::LambdaRunner.new(fetch_runtime_server, AwsLambdaRIC::get_user_agent)
  lambda_runner.run(app_root, handler)
end

#fetch_runtime_serverObject



212
213
214
215
216
217
# File 'lib/aws_lambda_ric.rb', line 212

def fetch_runtime_server
  ENV.fetch(AwsLambdaRIC::LambdaRunner::ENV_VAR_RUNTIME_API)
rescue KeyError
  puts 'Failed to get runtime server address from AWS_LAMBDA_RUNTIME_API env variable'
  exit(-2)
end

#startObject



207
208
209
210
# File 'lib/aws_lambda_ric.rb', line 207

def start
  AwsLambdaRIC::TelemetryLogger::from_env()
  bootstrap_handler
end