I'm using Celery alongside Django, and because I'm running into This Problem (Gunicorn not having access to OS environment variables) I've had to set EnvironmentFile=/etc/environment within my gunicorn.service file to access things like DJANGO_SECRET_KEY etc.
This works perfectly, no issues.
However when trying to get Celery setup, it's running into the same problem. My struggle is that celery already makes use of EnvironmentFile=/etc/conf.d/celery and I'd sort of like to keep my gunicorn and celery environment files separate...
I tried EnvironmentFile=/etc/environment /etc/conf.d/celery but of course this "Failed to load environment files"
Is it possible to load multiple environment files?
Or have one environment file "call" another"?
Or to simply load all environment files in a particular directory?
1 Answer
looks like according to
EnvironmentFile= ...may be specified more than once in which case all specified files are read.
So all I needed was
EnvironmentFile=/etc/environment
EnvironmentFile=/etc/conf.d/celeryThanks to @steeldriver for the help!