move zmq port to config file for C# and python

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-16 16:35:52 +02:00
parent 0d6ea4264f
commit 2ecbc9bfd4
17 changed files with 80 additions and 180 deletions
+4 -2
View File
@@ -3,7 +3,7 @@ import zmq
from threading import Thread, Event
from remote_command cimport RemoteCommand
cimport constants
import yaml
cdef class RemoteCommandHandler:
def __init__(self, object on_command):
@@ -12,7 +12,9 @@ cdef class RemoteCommandHandler:
self._router = self._context.socket(zmq.ROUTER)
self._router.setsockopt(zmq.LINGER, 0)
self._router.bind(f'tcp://*:{constants.ZMQ_PORT}')
with open(<str>constants.CONFIG_FILE, "r") as f:
config = yaml.safe_load(f)
self._router.bind(f'tcp://*:{config["zmq_port"]}')
self._dealer = self._context.socket(zmq.DEALER)
self._dealer.setsockopt(zmq.LINGER, 0)