docbrown/config/initializers/aws_sdk.rb
rhymes 36786cf554
Rails 6: enable zeitwerk autoloader (#8766)
* More loading fixes

* Go back to OpenStruct

* Shuffle things around

* Remove obsolete patches and unneeded requires

* Disable config.add_autoload_paths_to_load_path

* Fix pre-require errors

* Config not reloader
2020-06-22 16:27:55 +02:00

18 lines
763 B
Ruby

Rails.application.reloader.to_prepare do
AWS_LAMBDA = if Rails.env.production?
Aws::Lambda::Client.new(
region: ApplicationConfig["AWS_DEFAULT_REGION"],
access_key_id: ApplicationConfig["AWS_SDK_KEY"],
secret_access_key: ApplicationConfig["AWS_SDK_SECRET"],
)
else
# Fake Aws::Lambda::Client
Class.new do
def invoke(*)
# rubocop:disable Performance/OpenStruct
OpenStruct.new(payload: [{ body: { message: 0 }.to_json }.to_json])
# rubocop:enable Performance/OpenStruct
end
end.new
end
end