Phobetor / rabbitmq-supervisor-bundle

Symfony bundle to automatically create and update supervisor configurations for RabbitMQ consumer daemons
MIT License
104 stars 42 forks source link

Allow to specify PHP bin in command execution #25

Closed rubenrubiob closed 6 years ago

rubenrubiob commented 7 years ago

Hi!

I have just started using this bundle and it is actually helpful to manage supervisor, it saves a lot of configuration in servers.

There is one thing, tough, that I find missing, and it is the ability to specify which PHP binary use for workers. Right now, the generation of a worker results in something like this:

[program:app]
command=php /path/to/bin/console command worker --messages=250 --env=dev
....

But in some servers there are multiple PHP binaries installed, so it would be useful to be able to set the path to PHP binary depending on the environment, so it would result in something like this:

[program:app]
command=php7.1 /path/to/bin/console command worker --messages=250 --env=dev
....

I suppose it is something that could be done in the configuration file, and I would be willing to do it and make a pull request, but I am not sure where to put it. I think one option would be to set it under path element, something like this:

rabbit_mq_supervisor:
    supervisor_instance_identifier:     instance_name
    paths:
        php_bin:
            dev: /local/php
            prod: php71

Another option would be to create another branch within that structure, but I think it makes sense to have it under paths, as it is actually a path.

Thank you!

Regards.

Phobetor commented 6 years ago

Hi @rubenrubiob

This is released in version 3.1.0.

You can configure the php executable:

rabbit_mq_supervisor:
    paths:
        php_executable:       php

If you need different values in different environments, you can override the value in environment specific configuration files.

rubenrubiob commented 6 years ago

@Phobetor That is great, thank you!