diff docker_legacy/prosody/scripts/container_server @ 164:29873a41aae1

docker: new docker files are now in sat main repos, this one is legacy
author Goffi <goffi@goffi.org>
date Fri, 01 Jan 2021 18:33:52 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docker_legacy/prosody/scripts/container_server	Fri Jan 01 18:33:52 2021 +0100
@@ -0,0 +1,18 @@
+#!/usr/bin/env python2
+# this script allow to call prosodyctl and get configuration variables from linked containers
+import subprocess, SimpleXMLRPCServer, os
+
+def prosodyctl(command, profile, pwd):
+    process = subprocess.Popen(["/usr/bin/prosodyctl", command, profile], stdin=subprocess.PIPE)
+    if pwd:
+        process.communicate("%s\n%s" % (pwd,pwd))
+    return process.wait()
+
+def getenv(variable):
+    assert variable in ("SAT_PUBSUB_SECRET", "SAT_SALUT_SECRET", "DOMAIN")
+    return os.getenv(variable)
+
+server = SimpleXMLRPCServer.SimpleXMLRPCServer(("0.0.0.0", 9999))
+server.register_function(prosodyctl, "prosodyctl")
+server.register_function(getenv, "getenv")
+server.serve_forever()