From ad4fc9a8906b06d3799fe7375633e9446d48737b Mon Sep 17 00:00:00 2001 From: FinnIckler Date: Wed, 18 Oct 2023 12:17:14 +0200 Subject: [PATCH] don't run the worker config in the handler --- app/worker/env_config.rb | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/app/worker/env_config.rb b/app/worker/env_config.rb index 54869c5e..9e7adea8 100644 --- a/app/worker/env_config.rb +++ b/app/worker/env_config.rb @@ -2,22 +2,25 @@ require 'superconfig' -EnvConfig = SuperConfig.new do - # We don't have RAILS_ENV in ruby - if ENV.fetch('CODE_ENVIRONMENT', 'development') == 'development' - mandatory :LOCALSTACK_ENDPOINT, :string - # Have to be the same as in localstack to simulate authentication - mandatory :AWS_ACCESS_KEY_ID, :string - mandatory :AWS_SECRET_ACCESS_KEY, :string - optional :WCA_HOST, :string, '' - optional :CODE_ENVIRONMENT, 'development' - else - mandatory :QUEUE_URL, :string - mandatory :WCA_HOST, :string - mandatory :CODE_ENVIRONMENT, :string +# Don't run this on the handler +unless defined?(Rails) + EnvConfig = SuperConfig.new do + # We don't have RAILS_ENV in ruby + if ENV.fetch('CODE_ENVIRONMENT', 'development') == 'development' + mandatory :LOCALSTACK_ENDPOINT, :string + # Have to be the same as in localstack to simulate authentication + mandatory :AWS_ACCESS_KEY_ID, :string + mandatory :AWS_SECRET_ACCESS_KEY, :string + optional :WCA_HOST, :string, '' + optional :CODE_ENVIRONMENT, 'development' + else + mandatory :QUEUE_URL, :string + mandatory :WCA_HOST, :string + mandatory :CODE_ENVIRONMENT, :string + end + # We even need the AWS_REGION in dev because we fake authenticate with localstack + mandatory :AWS_REGION, :string + mandatory :PROMETHEUS_EXPORTER, :string + mandatory :DYNAMO_REGISTRATIONS_TABLE, :string end - # We even need the AWS_REGION in dev because we fake authenticate with localstack - mandatory :AWS_REGION, :string - mandatory :PROMETHEUS_EXPORTER, :string - mandatory :DYNAMO_REGISTRATIONS_TABLE, :string end