Add service categories and also unbreak things
This commit is contained in:
@@ -10,6 +10,7 @@ class ServiceConfig(BaseModel):
|
||||
name: str
|
||||
type: Literal["http", "tcp"]
|
||||
timeout: int = 5
|
||||
category: str | None = None
|
||||
|
||||
|
||||
class HTTPServiceConfig(ServiceConfig):
|
||||
@@ -58,6 +59,8 @@ def load_cfg() -> Config:
|
||||
if isinstance(cfg.services, dict):
|
||||
print("Your services config is using a dict, which is deprecated.")
|
||||
cfg.services = list(cfg.services.values())
|
||||
|
||||
cfg.services = sorted(cfg.services, key=lambda s: s.category or "")
|
||||
except ValidationError as e:
|
||||
raise SystemExit(str(e))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user