25 lines
641 B
Python
25 lines
641 B
Python
import sys
|
|
|
|
import yaml
|
|
from agebd.utils import get_git_root
|
|
|
|
REPO_ROOT = get_git_root(".")
|
|
SERVICES_REGISTRY_FILE = REPO_ROOT / "config" / "services_registry.yml"
|
|
|
|
|
|
def get_ioc_port(service_name_lower: str):
|
|
with open(SERVICES_REGISTRY_FILE) as f:
|
|
d = yaml.safe_load(f)
|
|
|
|
for service_dict in d["services"]:
|
|
if service_dict["name"].lower() == service_name_lower:
|
|
return service_dict["ioc_port"]
|
|
|
|
raise ValueError(f"Service with lowercase name {service_name_lower} not found")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
service_name_lower = sys.argv[1]
|
|
port = get_ioc_port(service_name_lower)
|
|
print(port)
|