mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-13 09:13:30 +01:00
fix: provider settings in top level field of configuration (#1161)
Configuration for some providers was given in the sub-field `provider_settings` combining the settings of several providers. Pydantic does not understand this very well and the configuration became cumbersome, especially in EOSdash. All provider settings from the `provider-settings` sub-field are now lifted to the top level field of the configuration. The changes are automatically migrated in the configuration. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
@@ -26,15 +26,6 @@ def weather_provider_ids() -> list[str]:
|
||||
]
|
||||
|
||||
|
||||
class WeatherCommonProviderSettings(SettingsBaseModel):
|
||||
"""Weather Forecast Provider Configuration."""
|
||||
|
||||
WeatherImport: Optional[WeatherImportCommonSettings] = Field(
|
||||
default=None,
|
||||
json_schema_extra={"description": "WeatherImport settings", "examples": [None]},
|
||||
)
|
||||
|
||||
|
||||
class WeatherCommonSettings(SettingsBaseModel):
|
||||
"""Weather Forecast Configuration."""
|
||||
|
||||
@@ -46,17 +37,9 @@ class WeatherCommonSettings(SettingsBaseModel):
|
||||
},
|
||||
)
|
||||
|
||||
provider_settings: WeatherCommonProviderSettings = Field(
|
||||
default_factory=WeatherCommonProviderSettings,
|
||||
json_schema_extra={
|
||||
"description": "Provider settings",
|
||||
"examples": [
|
||||
# Example 1: Empty/default settings (all providers None)
|
||||
{
|
||||
"WeatherImport": None,
|
||||
},
|
||||
],
|
||||
},
|
||||
weatherimport: WeatherImportCommonSettings = Field(
|
||||
default_factory=WeatherImportCommonSettings,
|
||||
json_schema_extra={"description": "Weather import provider settings"},
|
||||
)
|
||||
|
||||
@computed_field # type: ignore[prop-decorator]
|
||||
|
||||
Reference in New Issue
Block a user