Changed meaning of -c commandline argument for Beremiz service : only gives DEFAULT wamp config.
authorEdouard Tisserant
Wed, 14 Feb 2018 15:39:27 +0100
changeset 1934 67b06b30f2bd
parent 1933 cef288644088
child 1935 f2b0d849ea77
Changed meaning of -c commandline argument for Beremiz service : only gives DEFAULT wamp config.
If existing project already has a wamp config, it is taken instead.
Beremiz_service.py
--- a/Beremiz_service.py	Wed Feb 14 14:50:10 2018 +0100
+++ b/Beremiz_service.py	Wed Feb 14 15:39:27 2018 +0100
@@ -50,9 +50,9 @@
            -a        - autostart PLC (0:disable 1:enable) (default:0)
            -x        - enable/disable wxTaskbarIcon (0:disable 1:enable) (default:1)
            -t        - enable/disable Twisted web interface (0:disable 1:enable) (default:1)
-           -w        - web server port or "off" (default:8009)
-           -c        - WAMP client config file or "off" (default:wampconf.json)
-           -s        - WAMP client secret, given as a file or "off"
+           -w        - web server port or "off" to disable web server (default:8009)
+           -c        - WAMP client default config file (default:wampconf.json)
+           -s        - WAMP client secret, given as a file
            -e        - python extension (absolute path .py)
 
            working_dir - directory where are stored PLC files
@@ -587,10 +587,12 @@
             webport = None
         NS.WorkingDir = WorkingDir
 
-    if wampconf is None:
-        _wampconf = os.path.join(WorkingDir, "wampconf.json")
-        if os.path.exists(_wampconf):
-            wampconf = _wampconf
+    # Find pre-existing project WAMP config file
+    _wampconf = os.path.join(WorkingDir, "wampconf.json")
+
+    # If project's WAMP config file exits, override default (-c) 
+    if os.path.exists(_wampconf):
+        wampconf = _wampconf
 
     if wampconf is not None:
         try: