diff libervia/server/server.py @ 1368:9624c2a89a92

server: new `--build-only` flag: when this flag is set, the HTTP server is not launched, and Libervia quits immediately after running building tasks.
author Goffi <goffi@goffi.org>
date Fri, 20 Nov 2020 18:04:05 +0100
parents ce5cfe004d4e
children b5f2565c4bac
line wrap: on
line diff
--- a/libervia/server/server.py	Fri Nov 20 18:02:43 2020 +0100
+++ b/libervia/server/server.py	Fri Nov 20 18:04:05 2020 +0100
@@ -1571,10 +1571,17 @@
             reactor.stop()
             return failure
 
+    def _buildOnlyCb(self, __):
+        log.info(_("Stopping here due to --build-only flag"))
+        self.stop()
+
     def startService(self):
         """Connect the profile for Libervia and start the HTTP(S) server(s)"""
         self._init()
-        self.initialised.addCallback(self._startService)
+        if self.options['build-only']:
+            self.initialised.addCallback(self._buildOnlyCb)
+        else:
+            self.initialised.addCallback(self._startService)
         self.initialised.addErrback(self.initEb)
 
     ## URLs ##