mirror of
https://github.com/yavook/kiwi-simple-metrics.git
synced 2024-11-22 15:42:59 +00:00
25 lines
562 B
Python
25 lines
562 B
Python
|
from pydantic import AnyUrl, BaseModel
|
||
|
|
||
|
|
||
|
class LogSettings(BaseModel):
|
||
|
# if True, prints reports to stdout
|
||
|
enabled: bool = False
|
||
|
|
||
|
# how to format reports to stdout
|
||
|
format: str = "[{state}] {result}"
|
||
|
|
||
|
|
||
|
class WebhookSettings(BaseModel):
|
||
|
# webhooks to ping on success/on failure
|
||
|
url: AnyUrl | None = None
|
||
|
fail: AnyUrl | None = None
|
||
|
|
||
|
# allow insecure/self-signed webhook targets
|
||
|
insecure: bool = False
|
||
|
|
||
|
def get_url(self, failed: bool) -> AnyUrl | None:
|
||
|
if failed:
|
||
|
return self.fail
|
||
|
|
||
|
return self.url
|