summaryrefslogtreecommitdiff
path: root/pkg/server.tac
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-08-23 04:12:34 -0300
committerdrebs <drebs@riseup.net>2017-09-05 11:08:47 -0300
commit54f28b30c81da5f699cc90846f182377d9efb11a (patch)
tree0ceb3237e1c5cb2869f711161d09682f461c04d3 /pkg/server.tac
parentc8c742cb981cbe4087a7863ebc3d2a8e3dd93f25 (diff)
[feature] add a tac file for server
-- Related: #8867
Diffstat (limited to 'pkg/server.tac')
-rw-r--r--pkg/server.tac28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/server.tac b/pkg/server.tac
new file mode 100644
index 00000000..ef2cea50
--- /dev/null
+++ b/pkg/server.tac
@@ -0,0 +1,28 @@
+import os
+
+from twisted.application import service, strports
+from twisted.web import server
+
+from leap.soledad.server import entrypoint
+
+application = service.Application('soledad-server')
+
+# 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)