-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: ignore unknown env vars #141
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is not about unknown environment variables, it only happens if you try to use defined aliases
edge-proxy/src/edge_proxy/settings.py
Lines 119 to 121 in 6cde1e8
validation_alias=AliasChoices( | |
"api_poll_frequency_seconds", | |
"api_poll_frequency", |
@@ -136,6 +136,9 @@ class AppSettings(BaseModel): | |||
|
|||
|
|||
class AppConfig(AppSettings, BaseSettings): | |||
class Meta: | |||
extra = "ignore" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already the default per https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.extra
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... yes, but it's overridden specifically in the BaseSettings class as per this.
That being said, I expected (based on this) that something like docker run --rm -e FOO_BAR=foo flagsmith/edge-proxy:2.17.0
would also generate the error, but it didn't.
Probably more investigation is needed, although the solution I added here does prevent the error reported in the issue when using API_POLL_FREQUENCY
, but perhaps it also has some other knock on effects that need investigating before (if) we merge this.
376f357
to
92a2142
Compare
Related to this issue.
The purpose is to prevent the application from hard crashing when unrecognised environment variables are provided.