Skip to content

Instantly share code, notes, and snippets.

@lsmith77
Created February 5, 2011 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmith77/812538 to your computer and use it in GitHub Desktop.
Save lsmith77/812538 to your computer and use it in GitHub Desktop.
user controlled config merging
###
# uses http://yaml.org/type/merge.html
# imports read the given file and define implicit merge key alias for all possible paths
###
# config.yml
foo: bar
# implicitly defines a &ding merge key alias
ding:
# implicitly defines a &ding.lala merge key alias
lala:
- shala
- raba
app:
charset: UTF-8
error_handler: null
csrf_protection:
enabled: true
secret: xxxxxxxxxx
router: { resource: "%kernel.root_dir%/config/routing.yml" }
validation: { enabled: true, annotations: true }
templating: { engines: ['twig', 'php'] } #assets_version: SomeVersionScheme
session:
default_locale: en
lifetime: 3600
auto_start: true
# config_dev.yml
imports:
- { resource: config.yml }
# implicitly defines a &ding merge key alias
ding:
# implicitly defines a &ding.pong merge key alias
pong:
- rara
# config_test.yml
imports:
- { resource: config_dev.yml }
ding:
pong:
<<: *ding.pong
- roro
app:
<<: *app
error_handler: false
test: ~
# result
foo: bar
ding:
pong:
- rara
- roro
app:
error_handler: false
test: ~
charset: UTF-8
csrf_protection:
enabled: true
secret: xxxxxxxxxx
router: { resource: "%kernel.root_dir%/config/routing.yml" }
validation: { enabled: true, annotations: true }
templating: { engines: ['twig', 'php'] } #assets_version: SomeVersionScheme
session:
default_locale: en
lifetime: 3600
auto_start: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment