-
-
Save timurvafin/8599286 to your computer and use it in GitHub Desktop.
Rails application configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .env | |
# Setup sensitive information using .env file | |
# It should be added to .gitignore | |
AWS_ACESS_KEY_ID= | |
AWS_SECRET_ACCESS_KEY= | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/application.rb | |
# Rails.configuration is the main place to configure application | |
# If you need to setup some sensitive information like API keys, setup it with ENV | |
RailsBase::Application.configure do | |
config.carrierwave.storage = :fog | |
config.carrierwave.aws_access_key_id = ENV['AWS_ACESS_KEY_ID'] | |
config.carrierwave.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/carrierwave.rb | |
# Gem initializers should be configured with Rails.configuration | |
# They should not access ENV directly | |
CarrierWave.configure do |config| | |
config.storage = Rails.configuration.carrierwave.storage | |
config.fog_credentials = { | |
:provider => 'AWS', | |
:aws_access_key_id => Rails.configuration.carrierwave.aws_access_key_id, | |
:aws_secret_access_key => Rails.configuration.carrierwave.aws_secret_access_key | |
} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'custom_configuration' | |
gem 'dotenv-rails' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environments/test.rb | |
# Redefine application configuration using Rails configuration | |
# file for specific environment | |
RailsBase::Application.configure do | |
config.carrierwave.storage = :file | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment