Is there a custom tag in YAML for ruby to include a YAML file inside a YAML file?
#E.g.:
--- !include
filename: another.yml
A similar que
If you are in Rails, YAML can include ERB.
Combine that together, and here is how you can use <%= %>
to include one file from another:
database.yml
<% if File.exists?('/tmp/mysql.sock') %>
<%= IO.read('config/database.mysql.yml') %>
<% else %>
<%= IO.read('config/database.sqlite.yml') %>
<% end %>
database.sqlite.yml
sqlite: &defaults
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *defaults
database: db/development.sqlite3
test:
<<: *defaults
database: db/test.sqlite3
production:
<<: *defaults
database: db/production.sqlite3
database.mysql.yml
development:
adapter: mysql2
# ... the rest of your mysql configuration ...