From b10fae513e7eb3d32a617e7ad7c61a438b4463e2 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Thu, 2 Sep 2021 19:43:05 +0200 Subject: [PATCH] use paths to the keys relative to the configuration path --- aman/com/Euroscope.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/aman/com/Euroscope.py b/aman/com/Euroscope.py index 55706c8..5c124d2 100644 --- a/aman/com/Euroscope.py +++ b/aman/com/Euroscope.py @@ -50,11 +50,24 @@ class ReceiverThread(threading.Thread): class Euroscope: # @brief Initializes the ZMQ socket # @param[in] config The server configuration - def __init__(self, config : Server.Server): + def __init__(self, configPath : str, config : Server.Server): self.context = zmq.Context() + # find the key directories + serverKeyPath = os.path.join(os.path.join(configPath, 'keys'), 'server') + if False == os.path.isdir(serverKeyPath): + sys.stderr.write('No directory for the server key found') + sys.exit(-1) + print('Path to the server key: ' + serverKeyPath) + + clientKeyPath = os.path.join(os.path.join(configPath, 'keys'), 'clients') + if False == os.path.isdir(clientKeyPath): + sys.stderr.write('No directory for the client keys found') + sys.exit(-1) + print('Path to the client keys: ' + clientKeyPath) + # read the certificates - keyPairPath = glob.glob(os.path.join(config.ServerKeyPath, '*.key_secret')) + keyPairPath = glob.glob(os.path.join(serverKeyPath, '*.key_secret')) if 1 != len(keyPairPath): sys.stderr.write('No public-private keypair found for the server certificate') sys.exit(-1)