summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-03-16 10:16:46 +0100
committerdrebs <drebs@leap.se>2017-04-04 18:27:33 +0200
commit0b73bbd065685200cbcab7c668942c392c7bea8b (patch)
tree9dc700831fbe3081b39a24f8c4c57376bf3f84a9 /server
parent613a81facc799fd5f76c6057c168bfb41f7bf790 (diff)
[feat] improve blobs standalone testing options
Diffstat (limited to 'server')
-rw-r--r--server/src/leap/soledad/server/_blobs.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/server/src/leap/soledad/server/_blobs.py b/server/src/leap/soledad/server/_blobs.py
index 454ff5fe..76de49bb 100644
--- a/server/src/leap/soledad/server/_blobs.py
+++ b/server/src/leap/soledad/server/_blobs.py
@@ -210,11 +210,21 @@ if __name__ == '__main__':
from twisted.web.server import Site
from twisted.internet import reactor
- # XXX pass the path here
- root = BlobsResource('/tmp/blobs/user')
+ # parse command line arguments
+ import argparse
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--port', default=9000)
+ parser.add_argument('--path', default='/tmp/blobs/user')
+ args = parser.parse_args()
+
+ if not os.path.isdir(args.path):
+ os.makedirs(args.path)
+
+ root = BlobsResource(args.path)
# I picture somethink like
# BlobsResource(backend="filesystem", backend_opts={'path': '/tmp/blobs'})
factory = Site(root)
- reactor.listenTCP(9000, factory)
+ reactor.listenTCP(args.port, factory)
reactor.run()