Module: Cybele::Helpers::ActiveStorage

Included in:
AppBuilder
Defined in:
lib/cybele/helpers/active_storage.rb

Instance Method Summary collapse

Instance Method Details

#active_storage_settingObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cybele/helpers/active_storage.rb', line 6

def active_storage_setting
  %w[
    config/environments/production.rb
    config/environments/staging.rb
  ].each do |file|
    gsub_file file,
              /config.active_storage.service = :local/,
              'config.active_storage.service = :amazon'
  end

  %w[.env.local .env.production .env.staging .env.sample].each do |env|
    append_file(env, template_content('active_storage/amazon_env_all.erb'))
  end

  inject_into_file 'config/storage.yml',
                   template_content('active_storage/active_storage.yml.erb'),
                   before: '# Use rails credentials:edit to set the AWS secrets'
end