syncthing-monitor/syncthing_monitor/__main__.py

23 lines
728 B
Python

from syncthing_monitor.config_xml import parse_api_key, set_listen_ip_to_any
from syncthing_monitor.etcd_cluster_info import append_device_id, get_device_list
from syncthing_monitor.syncthing_rest import get_device_id, print_debug_info, post_devices
def loop(gui_port="8384", host="sync"):
api_key = parse_api_key()
print("Found API Key: {0}".format(api_key))
set_listen_ip_to_any()
device_id = get_device_id(host, gui_port, api_key)
print("Found Device ID: {0}".format(device_id))
append_device_id(device_id, 'etcd')
device_ids = get_device_list('etcd')
post_devices(device_ids, host, gui_port, api_key)
print_debug_info(host, gui_port, api_key)
if __name__ == "__main__":
loop()