summaryrefslogtreecommitdiff
path: root/src/leap/soledad/server
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-08-25 05:13:00 -0300
committerdrebs <drebs@riseup.net>2017-09-05 11:08:47 -0300
commitf26c027f1db489018c724a192309b93a8d8357c0 (patch)
treeb79dc2d77fe5babe358731dbdb342a4a94236fcc /src/leap/soledad/server
parent451604cdbb93d738d29855fcc69f44b4ec996645 (diff)
[pkg] move server.tac to server src folder
This way the file gets copied during package install. -- Related: #8867
Diffstat (limited to 'src/leap/soledad/server')
-rw-r--r--src/leap/soledad/server/server.tac35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/leap/soledad/server/server.tac b/src/leap/soledad/server/server.tac
new file mode 100644
index 00000000..1bc3dc69
--- /dev/null
+++ b/src/leap/soledad/server/server.tac
@@ -0,0 +1,35 @@
+import os
+
+from twisted.application import service, strports
+from twisted.web import server
+
+from leap.soledad.server import entrypoint
+
+application = service.Application('soledad-server')
+
+# local entrypoint
+local_description = 'tcp:2323:interface=127.0.0.1'
+local_site = server.Site(entrypoint.LocalServicesEntrypoint())
+
+local_server = strports.service(local_description, local_site)
+local_server.setServiceParent(application)
+
+# public entrypoint
+port = os.getenv('HTTPS_PORT', None)
+if port:
+ privateKey = os.getenv('PRIVKEY_PATH', '/etc/soledad/soledad-server.key')
+ certKey = os.getenv('CERT_PATH', '/etc/soledad/soledad-server.pem')
+ sslmethod = os.getenv('SSL_METHOD', 'SSLv23_METHOD')
+
+ public_description = ':'.join([
+ 'ssl',
+ 'port=' + str(port),
+ 'privateKey=' + privateKey,
+ 'certKey=' + certKey,
+ 'sslmethod=' + sslmethod])
+else:
+ public_description = 'tcp:port=2424:interface=0.0.0.0'
+public_site = server.Site(entrypoint.SoledadEntrypoint())
+
+public_server = strports.service(public_description, public_site)
+public_server.setServiceParent(application)