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

Improve settings.md wording #1526

Closed
Kludex opened this issue Jun 20, 2022 · 3 comments
Closed

Improve settings.md wording #1526

Kludex opened this issue Jun 20, 2022 · 3 comments
Labels
docs Improve documentation help wanted

Comments

@Kludex
Copy link
Sponsor Member

Kludex commented Jun 20, 2022

Nice addition!

I think we also need to change the introduction paragraphs in Settings:

Use the following options to configure Uvicorn, when running from the command line.

If you're running programmatically, using uvicorn.run(...), then use equivalent keyword arguments, eg. uvicorn.run("example:app", port=5000, reload=True, access_log=False). Please note that in this case, if you use reload=True or workers=NUM, you should put uvicorn.run into if __name__ == '__main__' clause in the main module.

You can also configure Uvicorn using environment variables with the prefix UVICORN_. For example, in case you want to run the app on port 5000, just set the environment variable UVICORN_PORT to 5000.

!!! note
    CLI options and the arguments for uvicorn.run() take precedence over environment variables.

    Also note that UVICORN_* prefixed settings cannot be used from within an environment configuration file. Using an environment configuration file with the --env-file flag is intended for configuring the ASGI application that uvicorn runs, rather than configuring uvicorn itself.

Suggestion ⬇️

Use the following options to configure Uvicorn, when running from the command line.

These options are mirrored as keyword arguments when [running programmatically](/index.md#running-programmatically).

Default settings can also be passed as environment variables using the `UVICORN_` prefix. For example, setting `UVICORN_PORT` to `5000` would make Uvicorn serve on port 5000 if `--port` (when using the CLI) or `port` (when running programmatically) have not been passed.

Originally posted by @florimondmanca in #1525 (review)

@Kludex Kludex added the docs Improve documentation label Jun 20, 2022
@Kludex
Copy link
Sponsor Member Author

Kludex commented Jun 20, 2022

I think we should mention who takes precedence as well 🤔

@Kludex Kludex changed the title Improve Settings documentation Improve settings.md wording Jun 20, 2022
@iudeen
Copy link
Contributor

iudeen commented Aug 15, 2022

A simple visual representation of what takes precedence would give developers a quick understanding. Since we have multiple levels of precedence, writing would become too wordy 🤔

@Kludex
Copy link
Sponsor Member Author

Kludex commented Oct 8, 2022

Closing this for house keeping.

@Kludex Kludex closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improve documentation help wanted
Projects
None yet
Development

No branches or pull requests

2 participants