Module: ElasticGraph::LambdaSupport
- Defined in:
- lib/elastic_graph/lambda_support.rb,
lib/elastic_graph/lambda_support/lambda_function.rb,
lib/elastic_graph/lambda_support/json_aware_lambda_log_formatter.rb
Defined Under Namespace
Modules: LambdaFunction Classes: JSONAwareLambdaLogFormatter
Class Method Summary collapse
-
.build_from_env(klass) ⇒ Object
Helper method for building ElasticGraph components from our lambda ENV vars.
Class Method Details
.build_from_env(klass) ⇒ Object
Helper method for building ElasticGraph components from our lambda ENV vars. ‘klass` is expected to be `ElasticGraph::Admin`, `ElasticGraph::GraphQL`, or `ElasticGraph::Indexer`.
This is meant to only deal with ENV vars and config that are common across all ElasticGraph components (e.g. logging and OpenSearch clients). ENV vars that are specific to one component should be handled elsewhere. This accepts a block which can further customize configuration as needed.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/elastic_graph/lambda_support.rb', line 22 def self.build_from_env(klass) klass.from_yaml_file( ENV.fetch("ELASTICGRAPH_YAML_CONFIG"), datastore_client_customization_block: ->(faraday) { configure_datastore_client(faraday) } ) do |settings| settings = settings.merge( "logger" => override_logger_config(settings.fetch("logger")), "datastore" => override_datastore_config(settings.fetch("datastore")) ) settings = yield(settings) if block_given? settings end end |