ip_port_migration 801 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/python3
  2. import os
  3. import sys
  4. import yaml
  5. def migrate(values):
  6. values["network"]["web_port"] = {
  7. "port_number": values["network"]["web_port"],
  8. "bind_mode": "published",
  9. "host_ips": [],
  10. }
  11. values["network"]["tcp_port"] = {
  12. "port_number": values["network"].get("tcp_port", 22000),
  13. "bind_mode": "published",
  14. "host_ips": [],
  15. }
  16. values["network"]["quic_port"] = {
  17. "port_number": values["network"].get("quic_port", 22000),
  18. "bind_mode": "published",
  19. "host_ips": [],
  20. }
  21. return values
  22. if __name__ == "__main__":
  23. if len(sys.argv) != 2:
  24. exit(1)
  25. if os.path.exists(sys.argv[1]):
  26. with open(sys.argv[1], "r") as f:
  27. print(yaml.dump(migrate(yaml.safe_load(f.read()))))