diff --git a/aws-lambda-layer/Rakefile b/aws-lambda-layer/Rakefile index 7af1a0e..d296cd9 100644 --- a/aws-lambda-layer/Rakefile +++ b/aws-lambda-layer/Rakefile @@ -4,6 +4,7 @@ require 'fileutils' BUILD_DIR = File.join(__dir__, 'build') DEFAULT_FREETDS_VERSION = '1.1.6' +DEFAULT_AWS_REGION = ENV['AWS_REGION'] || 'us-east-1' desc 'Build FreeTDS AWS Lambda Layer' task :build, [:freetds_version] do |_t, args| @@ -30,19 +31,21 @@ task :build, [:freetds_version] do |_t, args| end desc 'Build FreeTDS AWS Lambda Layer' -task :deploy, [:freetds_version] => [:build] do |_t, args| +task :deploy, [:freetds_version, :aws_region] => [:build] do |_t, args| version = args[:freetds_version] || ENV['FREETDS_VERSION'] || DEFAULT_FREETDS_VERSION + aws_region = args[:aws_region] || DEFAULT_AWS_REGION system(" aws lambda publish-layer-version \ --layer-name 'freetds' \ --description 'FreeTDS #{version} Layer' \ - --region 'us-east-1' \ + --region #{aws_region} \ --zip-file \"fileb://$(pwd)/build/freetds-layer-#{version}.zip\" ") end desc 'List available FreeTDS AWS Lambda Layers' -task :list_layers do |_t, args| - system('aws lambda list-layers --region us-east-1') +task :list_layers, [:aws_region] do |_t, args| + aws_region = args[:aws_region] || DEFAULT_AWS_REGION + system("aws lambda list-layers --region #{aws_region}") end