Adds app.yml to the application
Used 22 times
d
dpaluy
Usage
Every Rails application requires various configurations, like:
- domain_name
- admin_subdomain
etc.
The template creates `config/app.yml` and loads it with common parameters based on the environment.
Remember: Never store secrets there.
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/Vp7sy0"
Template Source
Review the code before running this template on your machine.
application do
"config.app = config_for(:app)"
end
run "touch config/app.yml"
inject_into_file "config/app.yml" do <<~EOF
# Example: Rails.configuration.app.domain_name
defaults: &defaults
admin_subdomain: <%= ENV.fetch('ADMIN_SUBDOMAIN', 'admin') %>
default_email_send_from: <%= ENV.fetch('DEFAULT_EMAIL_SEND_FROM', '[email protected]') %>
domain_name: <%= ENV.fetch('DOMAIN_NAME', 'example.test') %>
development:
<<: *defaults
test:
<<: *defaults
production:
<<: *defaults
EOF
end