質問編集履歴

1

carrierwave.rb修正

2019/12/01 13:47

投稿

hasegawa-kei
hasegawa-kei

スコア4

test CHANGED
File without changes
test CHANGED
@@ -457,3 +457,63 @@
457
457
  ### 試したこと
458
458
 
459
459
  docker-compose buildをし直したりしていますが...
460
+
461
+
462
+
463
+
464
+
465
+ ### 12/1修正後carrierwave.rb
466
+
467
+ ```ここに言語名を入力
468
+
469
+ require 'carrierwave/storage/abstract'
470
+
471
+ require 'carrierwave/storage/file'
472
+
473
+ require 'carrierwave/storage/fog'
474
+
475
+
476
+
477
+
478
+
479
+ CarrierWave.configure do |config|
480
+
481
+ config.storage :fog
482
+
483
+ config.fog_provider = 'fog/aws'
484
+
485
+ config.fog_directory = ENV['AWS_S3_BUCKET']
486
+
487
+ config.asset_host = 'https://s3.amazonaws.com/railspotoforio'
488
+
489
+ config.fog_credentials = {
490
+
491
+ provider: 'AWS',
492
+
493
+ aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
494
+
495
+ aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
496
+
497
+ region: ENV['AWS_S3_REGION'],
498
+
499
+ path_style: true
500
+
501
+ }
502
+
503
+ config.cache_storage = :fog
504
+
505
+ config.fog_public = false
506
+
507
+ config.fog_attributes = { cache_control: "max-age=#{365.days.to_i}" }
508
+
509
+
510
+
511
+ end
512
+
513
+
514
+
515
+ CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:].\-+]/
516
+
517
+
518
+
519
+ ```