Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't allow me to change values with ScriptHandler::buildParameters #44

Open
yellowmamba opened this issue Apr 19, 2016 · 4 comments
Open

Comments

@yellowmamba
Copy link

yellowmamba commented Apr 19, 2016

Hi there,

I installed this plugin for my Symfony2 project. When the composer install task runs, it doesn't ask me to provide parameters like it does if I run composer install manually. I have this in my composer.json file:

"scripts": {
     "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        ]
    },
    "extra": {
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
    },

If it doesn't generate correct parameter file, the next hook clearCache won't work properly because of the wrong database connection. Is there anything I can do to get buildParameters working during a deployment?

I do not have --no-interaction argument in the composer install command.

@sudosu
Copy link

sudosu commented Aug 3, 2016

Same issue.

@alister
Copy link

alister commented Aug 3, 2016

When I deploy my own Symfony projects with Capistrano, I have already put a complete parameters.yml.dist in place (in a shared folder, deployed seperately), and then symlinked it, into the app/config/ directory with the :linked_files. That is used as the source to generate the parameters.yml file for use with the Composer scripts. Any variables that I choose to leave as '~' in the .yml.dist file shows up in the .yml file as 'null'.

Another way to enable secrets in the files is to use environment variables, which can be set in the Apache Vhost, or php-fpm settings.

@yellowmamba
Copy link
Author

@sudosu Thanks for bringing this back to my attention. Have you tried set :composer_install_flags, '--no-dev --quiet --optimize-autoloader' without the --no-interaction flag? Because I need to run Capistrano inside CI so interactive shell is not an option for me.

@alister True. But normally one shouldn't put the real credentials like database password in the dist file in git. These sensitive parameters should only be set upon deployment. The values you defined in the dist file will be served as the default values.

@sudosu
Copy link

sudosu commented Aug 4, 2016

@yellowmamba Yes, I tried it without --no-interaction and nothing changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants