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

Enable read of uvicorn settings from environment variables #1279

Merged
merged 1 commit into from
Dec 6, 2021

Conversation

Kludex
Copy link
Sponsor Member

@Kludex Kludex commented Dec 4, 2021

Closes #693

This is a further implementation proposed by #696. The solution proposed there only enabled uvicorn to read environment variables in case it was run using python -m uvicorn instead of the usual uvicorn entry point. This PR solves that issue.

Here we go further and add a test that loads one of the many settings options, and check that it's used successfully by uvicorn, and also shows a priority between CLI arguments and environment variables i.e. CLI arguments always have priority in case environment variables are present.

Do we have alternatives for this?

Yes. Gunicorn uses a single environment variable called GUNICORN_CMD_ARGS, instead of using a prefix. See more about it here.


Copied from #1114

@Kludex
Copy link
Sponsor Member Author

Kludex commented Dec 4, 2021

@euri10 ping

@Kludex Kludex merged commit 9c1b88c into encode:master Dec 6, 2021
@rspadim
Copy link

rspadim commented Dec 6, 2021

Very nice, thanks a lot!

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

Successfully merging this pull request may close these issues.

Include a environment variable to change arg commands
3 participants