diff --git a/.vscode/launch.json b/.vscode/launch.json index 437feb4..b95c351 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,6 +9,10 @@ "type": "python", "request": "launch", "module": "kiwi_simple_metrics.main", + "env": { + "METRIC_DISK__THRESHOLD": "85", // workaround! + "METRIC_DISK__PARAMS": "[\"/var\", \"/\"]", + }, "justMyCode": true } ] diff --git a/kiwi_simple_metrics/settings.py b/kiwi_simple_metrics/settings.py index 40a2543..2ac035a 100644 --- a/kiwi_simple_metrics/settings.py +++ b/kiwi_simple_metrics/settings.py @@ -24,17 +24,9 @@ class Settings(BaseSettings): env_nested_delimiter="__", ) - cpu: MetricS = MetricS( - threshold=100, - ) - - memory: MetricS = MetricS( - threshold=90, - ) - - disk: ParamMS = ParamMS( - threshold=85, - ) + cpu: MetricS = MetricS(threshold=100) + memory: MetricS = MetricS(threshold=90) + disk: ParamMS = ParamMS(threshold=85) SETTINGS = Settings() diff --git a/min_fail_example.py b/min_fail_example.py new file mode 100644 index 0000000..c812183 --- /dev/null +++ b/min_fail_example.py @@ -0,0 +1,25 @@ +from pydantic import BaseModel + + +class SubModel(BaseModel): + optional: int = 42 + required: str + + +class Settings(BaseModel): + sub: SubModel = SubModel(required="foo") + sub2: SubModel = SubModel(required="bar") + + +def main() -> None: + settings = Settings.model_validate({ + "sub": {"optional": "69"}, + }) + + # settings = Settings() + + print(settings.model_dump()) + + +if __name__ == "__main__": + main()