Browse Source

use paths to the keys relative to the configuration path

Sven Czarnian 3 years ago
parent
commit
b10fae513e
1 changed files with 15 additions and 2 deletions
  1. 15 2
      aman/com/Euroscope.py

+ 15 - 2
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)