Remove AWS

This commit is contained in:
Eric 2020-06-09 16:57:03 -05:00 committed by Eric Schultz
parent 6c6257b135
commit 47857f7b86
14 changed files with 15 additions and 204 deletions

View file

@ -2,9 +2,6 @@ export DEVISE_SECRET_KEY='-- secret string --' #bundle exec rake secret
export SECRET_TOKEN='-- secret string --' #bundle exec rake secret
export STRIPE_API_KEY='REPLACE' # use your test private key from your stripe account
export STRIPE_API_PUBLIC='REPLACE' # use your test public key from your stripe account
export S3_BUCKET_NAME='REPLACE'
export AWS_ACCESS_KEY='REPLACE'
export AWS_SECRET_ACCESS_KEY='REPLACE'
### optional below
export ORG_NAME="default_organization"

View file

@ -3,9 +3,6 @@ export SECRET_TOKEN='0696452e54b14758b8534437d8cf418ea920ff23bb9c3a061a9ab2827ba
export STRIPE_API_KEY='REPLACE' # use your test private key from your stripe account
export STRIPE_API_PUBLIC='REPLACE' # use your test public key from your stripe account
export S3_BUCKET_NAME='REPLACE'
export AWS_ACCESS_KEY='REPLACE'
export AWS_SECRET_ACCESS_KEY='REPLACE'
### optional below
export ORG_NAME="default_organization"

View file

@ -25,10 +25,6 @@ gem 'rack-attack', '~> 5.2' # for blocking ip addressses
gem 'rack-ssl', '~> 1.4'
gem 'sprockets', '~> 3.7'
# AWS services
gem 'aws-sdk', '~> 1.67'
gem 'aws-ses', '~> 0.6.0' # REST email integration API
# External Services
gem 'fullcontact', '~> 0.18.0' # Full Contact API; includes #Hashie::Mash

View file

@ -85,16 +85,6 @@ GEM
amq-protocol (2.3.0)
andand (1.3.3)
ast (2.4.0)
aws-sdk (1.67.0)
aws-sdk-v1 (= 1.67.0)
aws-sdk-v1 (1.67.0)
json (~> 1.4)
nokogiri (~> 1)
aws-ses (0.6.0)
builder
mail (> 2.2.5)
mime-types
xml-simple
bcrypt (3.1.13)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
@ -446,7 +436,6 @@ GEM
activejob (>= 4.0.0)
wisper
wisper-rspec (1.1.0)
xml-simple (1.1.5)
zeitwerk (2.3.0)
PLATFORMS
@ -454,8 +443,6 @@ PLATFORMS
DEPENDENCIES
action_mailer_matchers (~> 1.2)
aws-sdk (~> 1.67)
aws-ses (~> 0.6.0)
binding_of_caller (~> 0.8.0)
bootsnap (~> 1.4)
bunny (~> 2.14, >= 2.14.2)

View file

@ -1,25 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class AwsPresignedPostsController < ApplicationController
before_action :authenticate_user!
# post /presigned_posts
# Create some keys using the AWS gem so the user can do direct-to-S3 uploads
# http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/PresignedPost.html
def create
uuid = SecureRandom.uuid
p = S3Bucket.presigned_post(
key: "tmp/#{uuid}/${filename}",
success_action_status: 201,
acl: 'public-read',
expiration: 30.days.from_now
)
render json: {
s3_presigned_post: p.fields.to_json,
s3_direct_url: p.url,
s3_uuid: uuid
}
end
end

View file

@ -10,11 +10,6 @@ default:
nonprofit: "public/images/fallback/default-nonprofit.png"
campaign: "public/fallback/default-campaign-background.jpg"
aws:
access_key_id: <%= ENV['AWS_ACCESS_KEY'] %>
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
region: us-west-1
bucket: commitchange
mailer:
delivery_method: "sendmail"

View file

@ -56,21 +56,7 @@ Config.schema do
required(:campaign).filled(:str?)
end
end
optional(:aws).schema do
# the region your AWS bucket is in
optional(:region).filled(:str?)
# the name of your aws bucket
required(:bucket).filled(:str?)
# your AWS access key. Set from AWS_ACCESS_KEY ENV variable
required(:access_key_id).filled(:str?)
# your AWS secret access key. Set from AWS_SECRET_ACCESS_KEY ENV variable
required(:secret_access_key).filled(:str?)
end
required(:mailer).schema do
# an action mailer delivery method
# Default is sendmail

View file

@ -1,12 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
AWS.config(
region: Settings.aws.region,
access_key_id: Settings.aws.access_key_id,
secret_access_key: Settings.aws.secret_access_key
)
s3 = AWS::S3.new
S3Bucket = s3.buckets[Settings.aws.bucket]

View file

@ -14,11 +14,6 @@ default:
nonprofit: "public/images/fallback/default-nonprofit.png"
campaign: "public/fallback/default-campaign-background.jpg"
aws:
access_key_id: <%= ENV['AWS_ACCESS_KEY'] %>
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
bucket: <%= ENV['S3_BUCKET_NAME'] %>
mailer:
delivery_method: "sendmail"
address: "localhost"

View file

@ -22,22 +22,13 @@ module CreatePeerToPeerCampaign
campaign.published = true
campaign.profile = profile
campaign.save
campaign.main_image.attach(parent_campaign.main_image.blob) if parent_campaign.main_image.attached?
campaign.background_image.attach(parent_campaign.background_image.blob) if parent_campaign.background_image.attached?
campaign.banner_image.attach(parent_campaign.banner_image.blob) if parent_campaign.banner_image.attached?
begin
campaign.main_image.attach(parent_campaign.main_image.blob) if parent_campaign.main_image.attached?
rescue StandardError
AWS::S3::Errors::NoSuchKey
end
begin
campaign.background_image.attach(parent_campaign.background_image.blob) if parent_campaign.background_image.attached?
rescue StandardError
AWS::S3::Errors::NoSuchKey
end
begin
campaign.banner_image.attach(parent_campaign.banner_image.blob) if parent_campaign.banner_image.attached?
rescue StandardError
AWS::S3::Errors::NoSuchKey
end
campaign
end

View file

@ -29,17 +29,10 @@ module InsertDuplicate
dupe.save!
begin
dupe.main_image.attach(campaign.main_image.blob) if campaign.main_image.attached?
rescue StandardError
AWS::S3::Errors::NoSuchKey
end
begin
dupe.background_image.attach(campaign.background_image.blob) if campaign.background_image.attached?
rescue StandardError
AWS::S3::Errors::NoSuchKey
end
dupe.main_image.attach(campaign.main_image.blob) if campaign.main_image.attached?
dupe.background_image.attach(campaign.background_image.blob) if campaign.background_image.attached?
InsertDuplicate.campaign_gift_options(campaign_id, dupe.id)
@ -83,17 +76,10 @@ module InsertDuplicate
dupe.save!
begin
dupe.main_image.attach(event.main_image.blob) if event.main_image.attached?
rescue StandardError
AWS::S3::Errors::NoSuchKey
end
begin
dupe.background_image.attach( event.background_image.blob) if event.background_image.attached?
rescue StandardError
AWS::S3::Errors::NoSuchKey
end
dupe.main_image.attach(event.main_image.blob) if event.main_image.attached?
dupe.background_image.attach( event.background_image.blob) if event.background_image.attached?
InsertDuplicate.ticket_levels(event_id, dupe.id)
InsertDuplicate.event_discounts(event_id, dupe.id)

View file

@ -66,7 +66,6 @@
"dependencies": {
"@rails/activestorage": "^6.0.2-2",
"attr-binder": "0.3.1",
"aws-sdk": "^2.402.0",
"chart.js": "2.1.4",
"color": "^3.1.0",
"commons.css": "0.1.8",

View file

@ -1,16 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
require 'rails_helper'
require 'controllers/support/shared_user_context'
describe AwsPresignedPostsController, type: :controller do
describe 'authorization' do
include_context :shared_user_context
describe 'rejects unauthorized users' do
describe 'create' do
include_context :open_to_registered, :post, :create
end
end
end
end

View file

@ -1974,21 +1974,6 @@ autoprefixer@^9.6.1:
postcss "^7.0.30"
postcss-value-parser "^4.1.0"
aws-sdk@^2.402.0:
version "2.685.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.685.0.tgz#ba5add21e98cc785b3c05ceb9f3fcb8ab046aa8a"
integrity sha512-mAOj7b4PuXRxIZkNdSkBWZ28lS2wYUY7O9u33nH9a7BawlttMNbxOgE/wDCPMrTLfj+RLQx0jvoIYj8BKCTRFw==
dependencies:
buffer "4.9.1"
events "1.1.1"
ieee754 "1.1.13"
jmespath "0.15.0"
querystring "0.2.0"
sax "1.2.1"
url "0.10.3"
uuid "3.3.2"
xml2js "0.4.19"
aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
@ -2404,15 +2389,6 @@ buffer-xor@^1.0.3:
resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=
buffer@4.9.1:
version "4.9.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298"
integrity sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"
isarray "^1.0.0"
buffer@^4.3.0:
version "4.9.2"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.2.tgz#230ead344002988644841ab0244af8c44bbe3ef8"
@ -4140,11 +4116,6 @@ eventemitter3@^4.0.0:
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384"
integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==
events@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=
events@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/events/-/events-3.1.0.tgz#84279af1b34cb75aa88bf5ff291f6d0bd9b31a59"
@ -5325,7 +5296,7 @@ icss-utils@^4.0.0, icss-utils@^4.1.1:
dependencies:
postcss "^7.0.14"
ieee754@1.1.13, ieee754@^1.1.4:
ieee754@^1.1.4:
version "1.1.13"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
@ -6277,11 +6248,6 @@ jest@^24.1.0:
import-local "^2.0.0"
jest-cli "^24.9.0"
jmespath@0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217"
integrity sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=
jquery.cookie@1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jquery.cookie/-/jquery.cookie-1.4.1.tgz#d63dce209eab691fe63316db08ca9e47e0f9385b"
@ -9988,12 +9954,7 @@ sass-loader@^8.0.2:
schema-utils "^2.6.1"
semver "^6.3.0"
sax@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a"
integrity sha1-e45lYZCyKOgaZq6nSEgNgozS03o=
sax@>=0.6.0, sax@^1.2.4, sax@~1.2.1, sax@~1.2.4:
sax@^1.2.4, sax@~1.2.1, sax@~1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
@ -11194,14 +11155,6 @@ url-parse@^1.4.3:
querystringify "^2.1.1"
requires-port "^1.0.0"
url@0.10.3:
version "0.10.3"
resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64"
integrity sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=
dependencies:
punycode "1.3.2"
querystring "0.2.0"
url@0.11.0, url@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1"
@ -11261,11 +11214,6 @@ uuid@2.0.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.2.tgz#48bd5698f0677e3c7901a1c46ef15b1643794726"
integrity sha1-SL1WmPBnfjx5AaHEbvFbFkN5RyY=
uuid@3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
uuid@^3.3.2, uuid@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
@ -11665,19 +11613,6 @@ xml-name-validator@^3.0.0:
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==
xml2js@0.4.19:
version "0.4.19"
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7"
integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==
dependencies:
sax ">=0.6.0"
xmlbuilder "~9.0.1"
xmlbuilder@~9.0.1:
version "9.0.7"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d"
integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"