Cascading/Inherited/Shared Rails configuration environments -
my staging , production environment rails configuration 99% same few things set differently (e.g. log level), , i'd eliminate duplication between 2 environment files.
for example, have this:
# config/environments/staging.rb myapp::application.configure config.cache_classes = true config.static_cache_control = "public, max-age=31536000" config.log_level = :debug # ... end # config/environments/production.rb myapp::application.configure config.cache_classes = true config.static_cache_control = "public, max-age=31536000" config.log_level = :info # ... end
any recommendations on best way create shared configuration doesn't affect development environment?
in projects, have 3 production-like environments have file called shared_production.rb under config/environments
put common configuration
myapp::application.configure config.cache_classes = true config.consider_all_requests_local = false #more shared configs end
and in each environment specific config file (production.rb, staging.rb, testing.rb) do
require file.expand_path('../shared_production', __file__) myapp::application.configure config.log_level = :debug #more environment specific configs end
Comments
Post a Comment