23 lines
506 B
Python

from dataclasses import dataclass, field, asdict
from typing import List
import yaml
@dataclass
class Host:
ip: str
user: str
def __repr__(self) -> str:
return yaml.dump(asdict(self), default_flow_style=False)
@dataclass
class Service:
name: str
compose_file: str
env_file: str
host: Host = field(default_factory=Host)
ports: List[int] = field(default_factory=list)
def __repr__(self) -> str:
return yaml.dump(asdict(self), default_flow_style=False)