From 3ab193bc3f40c0336a16dd21c3f3dc66eb86a842 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 6 Nov 2016 18:35:46 +0100 Subject: Adding optional S3, fail-mastodon --- Gemfile | 1 + Gemfile.lock | 8 +++++ config/initializers/paperclip.rb | 10 ++++++ public/500.html | 71 +++++++++++++-------------------------- public/oops.png | Bin 0 -> 120305 bytes 5 files changed, 42 insertions(+), 48 deletions(-) create mode 100644 config/initializers/paperclip.rb create mode 100644 public/oops.png diff --git a/Gemfile b/Gemfile index 917b3d294..fc5dce72b 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem 'font-awesome-rails' gem 'paperclip', '~> 4.3' gem 'paperclip-av-transcoder' +gem 'aws-sdk', '~> 2.3' gem 'http' gem 'httplog' diff --git a/Gemfile.lock b/Gemfile.lock index ae163a1b2..f3ec10c0a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,6 +44,12 @@ GEM ast (2.3.0) av (0.9.0) cocaine (~> 0.5.3) + aws-sdk (2.6.18) + aws-sdk-resources (= 2.6.18) + aws-sdk-core (2.6.18) + jmespath (~> 1.0) + aws-sdk-resources (2.6.18) + aws-sdk-core (= 2.6.18) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) @@ -139,6 +145,7 @@ GEM jbuilder (2.6.0) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) + jmespath (1.3.1) jquery-rails (4.1.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -374,6 +381,7 @@ PLATFORMS DEPENDENCIES active_record_query_trace addressable + aws-sdk (~> 2.3) better_errors binding_of_caller browserify-rails diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb new file mode 100644 index 000000000..73eb3356b --- /dev/null +++ b/config/initializers/paperclip.rb @@ -0,0 +1,10 @@ +if ENV['S3_ENABLED'] == 'true' + Paperclip::Attachment.default_options[:storage] = :s3 + + Paperclip::Attachment.default_options[:s3_credentials] = { + bucket: ENV.fetch('S3_BUCKET'), + access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'), + secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'), + s3_region: ENV.fetch('S3_REGION') + } +end diff --git a/public/500.html b/public/500.html index af46b8a5a..aa18fc722 100644 --- a/public/500.html +++ b/public/500.html @@ -2,66 +2,41 @@ - We're sorry, but something went wrong (500) + We're sorry, but something went wrong + -
+ Mastodon +

We're sorry, but something went wrong.

-

If you are the application owner check the logs for more information.

diff --git a/public/oops.png b/public/oops.png new file mode 100644 index 000000000..0abddad3e Binary files /dev/null and b/public/oops.png differ -- cgit