ipunkt / docker-laravel-queue-worker

A docker image for working with queues being monitored by supervisor as recommended by laravel.
https://hub.docker.com/r/ipunktbs/laravel-queue-worker/
MIT License
70 stars 20 forks source link

Use variables in Supervisor's config files #15

Open elcapo opened 2 years ago

elcapo commented 2 years ago

From the official page of Supervisor:

Environment variables that are present in the environment at the time that supervisord is started can be used in the configuration file using the Python string expression syntax %(ENV_X)s:

[program:example]
command=/usr/bin/example --loglevel=%(ENV_LOGLEVEL)s

This means that the command line can be directly be written as:

## Suggested
command=php /var/www/app/artisan queue:work %(ENV_QUEUE_CONNECTION)s --queue=%(ENV_QUEUE_NAME)s --memory=%(ENV_MEMORY_LIMIT)s

## Current
command=php /var/www/app/artisan queue:work %%QUEUE_CONNECTION%% --queue=%%QUEUE_NAME%% --memory=%%MEMORY_LIMIT%%

Removing the template "variables" from the current command, would also simplify init.sh.