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

Allow overriding settings from fastAPI app #166

Closed
pheanex opened this issue Feb 11, 2021 · 2 comments
Closed

Allow overriding settings from fastAPI app #166

pheanex opened this issue Feb 11, 2021 · 2 comments

Comments

@pheanex
Copy link

pheanex commented Feb 11, 2021

  • FastAPI Contrib version: 0.2.9
  • FastAPI version: 0.52.0
  • Python version: 3.8.2
  • Operating System: Linux

Description

Currently we can only override settings with settings from the fastAPI app by using environment variables (See the Todo).
Can we implement this functionaility, so we do not have to go through the environment variables?

@levchik
Copy link
Contributor

levchik commented Feb 11, 2021

Hi @pheanex,

I didn't try myself, but I think mutating settings object directly solves your use-case:

from fastapi_contrib.conf import settings

settings.log_level = "DEBUG"

If you do it right at the start of your app, I guess these changed settings should apply globally and work as expected.

And yeah, if this doesn't work and you have an idea on how to do it properly, you are very welcome to suggest.

@levchik
Copy link
Contributor

levchik commented Mar 17, 2021

Ok, I'm closing this for now

@levchik levchik closed this as completed Mar 17, 2021
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

2 participants