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

Environment variable parsing not supported #58

Open
humzaiqbal opened this issue Jul 17, 2016 · 6 comments
Open

Environment variable parsing not supported #58

humzaiqbal opened this issue Jul 17, 2016 · 6 comments

Comments

@humzaiqbal
Copy link

I want to use an environment variable as my BROKER_URL in a .ini file but it isn't parsed correctly. When I try to do
[celery]
BROKER_URL = ${REDIS_URL}
I get the following error

@humzaiqbal humzaiqbal changed the title Environment parsing not supported Environment variable parsing not supported Jul 17, 2016
@aristobulo-eezee
Copy link

Actually I have the same issue without using ENV variables, even using the examples

@sontek
Copy link
Owner

sontek commented Feb 24, 2021

The way you would do this is by using standard template variables in the ini.file and then pass the environment variable over:

broker_url = %(REDIS_URL)s

and then you can use:

celery -A pyramid_celery.celery_app worker --ini development.ini --ini-var=REDIS_URL=$REDIS_URL

I'm going to keep the issue open to consider introducing something like .env or some other sort of environment variable reading on top of that.

@phrfpeixoto
Copy link

I tried that, but couldn't get it to work.

@sontek
Copy link
Owner

sontek commented Feb 28, 2021

@phrfpeixoto Do you have the config and command you ran so I can see it? and what shell you use (bash, zsh, fish, etc)

@phrfpeixoto
Copy link

I'm putting a PR together to illustrate it.
What fails on me is starting pserve itself: It seems it can only replace variables inside the [main] section of the config.

@renierdbruyn
Copy link

Please make allowance for environment variables to be parsed...

celery -A pyramid_celery.celery_app worker --ini development.ini --ini-var=REDIS_URL=$REDIS_URL

this is very useful information, but the pyramid application fails to start due to the fact that as @phrfpeixoto pointed out, pserve only replaces variables inside [app:main] and not in [celery]

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

5 participants