Incenteev / ParameterHandler

Composer script handling your ignored parameter file
MIT License
926 stars 98 forks source link

Import parameters from other subsections as well #35

Open artur-gajewski opened 10 years ago

artur-gajewski commented 10 years ago

If the parameters.yml-dist file has following structure:

parameters:
   login_required: false

twig:
    globals:
        show_forkme: true

Only the parameters section will be checked for missing parameters and imported, but the other sections remain unchecked / unimported. Should also import these.

annitya commented 9 years ago

For an eZPublish-project we have the following yaml-configuration:

doctrine:
    dbal:
       driver:
       host:
       port:
       dbname:
       user:
       password:
       charset:

All excellent candidates for a dist-file, however the dbal-key is unreachable. This has led us to the following implementation. Not ideal, duplicate-code considered, but functional:

parameters:
    database_driver: pdo_mysql
    database_port: 3306
    database_charset: UTF8
    database_host: ~
    database_name: ~
    database_user: ~
    database_password: ~
    solr_uri: ~
    http_purge_servers: ~

doctrine:
    dbal:
       driver: %database_driver%
       host: %database_host%
       port: %database_port%
       dbname: %database_name%
       user: %database_user%
       password: %database_password%
       charset: %database_charset%

If it where possible to specify deeper (and perhaps multiple) parameters-keys, much would be solved. Something along the lines of:

{
    "file" : "app/config/databases.yml",
    "dist-file" : "app/config/databases.dist.yml",
    "parameter-key" : [
        "doctrine/dbal",
        "some/even/deeper/key"
    ]
}

The ParameterHandler could then iterate over the settings found beneath the specified key(s).

Is this something that could work? @stof

Edit: I would be happy to create a pull-request for this, but first let me know if the approach is viable! :)