Module: Jets::Resource::Lambda::Function::Environment

Included in:
ApiGateway::BasePath::Function, Jets::Resource::Lambda::Function
Defined in:
lib/jets/resource/lambda/function/environment.rb

Instance Method Summary collapse

Instance Method Details

#env_propertiesObject



3
4
5
6
7
# File 'lib/jets/resource/lambda/function/environment.rb', line 3

def env_properties
  env_vars = Jets::Dotenv.load!(true)
  variables = environment.merge(env_vars)
  {environment: { variables: variables }}
end

#environmentObject



9
10
11
12
# File 'lib/jets/resource/lambda/function/environment.rb', line 9

def environment
  env = Jets.config.environment ? Jets.config.environment.to_h : {}
  env.deep_merge(jets_env)
end

#jets_envObject

These jets env variables are special variables that get included to keeps some state



15
16
17
18
19
20
21
22
# File 'lib/jets/resource/lambda/function/environment.rb', line 15

def jets_env
  env = {}
  env[:JETS_ENV] = Jets.env.to_s
  env[:JETS_ENV_EXTRA] = Jets.config.env_extra if Jets.config.env_extra
  env[:JETS_PROJECT_NAME] = ENV['JETS_PROJECT_NAME'] if ENV['JETS_PROJECT_NAME']
  env[:JETS_STAGE] = Jets::Resource::ApiGateway::Deployment.stage_name
  env
end