Class: AwsLambdaRIC::Bootstrap

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

Instance Method Summary collapse

Instance Method Details

#bootstrap_handlerObject



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

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



204
205
206
207
208
209
# File 'lib/aws_lambda_ric.rb', line 204

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



199
200
201
202
# File 'lib/aws_lambda_ric.rb', line 199

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