Skip to main content

environment_file_configuration

🛠 Customize environment-specific configurations​

Each Rails environment has its own configuration file in config/environments. Use these files to tailor settings like log levels, asset hosts, and caching strategies for development, test, and production. This ensures consistent behavior and optimal performance across environments.

# config/environments/production.rb
Rails.application.configure do
config.log_level = :info
config.asset_host = 'https://assets.example.com'
config.cache_store = :mem_cache_store, 'cache-1.example.com'
end

# config/environments/development.rb
Rails.application.configure do
config.log_level = :debug
config.asset_host = nil
config.cache_store = :null_store
end