[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Move configuration code into common.
commit 0b318874ece957c8f27e129033ed70e78b4438f9
Author: Arturo Filastò <art@xxxxxxxxxxxxxx>
Date: Sat Jul 21 02:45:36 2012 +0200
Move configuration code into common.
---
oonib/common.py | 6 ++++++
oonib/oonibackend.conf | 3 ++-
oonib/oonibackend.py | 10 ++--------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/oonib/common.py b/oonib/common.py
new file mode 100644
index 0000000..2f1b6f9
--- /dev/null
+++ b/oonib/common.py
@@ -0,0 +1,6 @@
+from ooni.utils import Storage
+from ooni.utils.config import Config
+
+config = Storage()
+config.main = Config('main', 'oonibackend.conf')
+config.daphn3 = Config('daphn3', 'oonibackend.conf')
diff --git a/oonib/oonibackend.conf b/oonib/oonibackend.conf
index 864df1e..3ccfdef 100644
--- a/oonib/oonibackend.conf
+++ b/oonib/oonibackend.conf
@@ -3,5 +3,6 @@ http_port = 8080
dns_udp_port = 5354
dns_tcp_port = 8002
daphn3_port = 9666
+server_version = Apache
[daphn3]
-pcap_file = 'server.pcap'
+pcap_file = server.pcap
diff --git a/oonib/oonibackend.py b/oonib/oonibackend.py
index 2ad7f34..fe1a760 100755
--- a/oonib/oonibackend.py
+++ b/oonib/oonibackend.py
@@ -16,19 +16,13 @@ from twisted.web import resource, server, static
from twisted.web.microdom import escape
from twisted.names import dns
-from ooni.utils import Storage
-from ooni.utils.config import Config
-
+from oonib.common import config
from oonib.backends.http import HTTPBackend
from oonib.backends.dns import ProxyDNSServer
from oonib.backends.daphn3 import Daphn3Server
-config = Storage()
-config.main = Config('main', 'oonibackend.conf')
-config.daphn3 = Config('daphn3', 'oonibackend.conf')
-
# This tells twisted to set the
-server.version = "Apache"
+server.version = config.main.server_version
application = service.Application('oonibackend')
serviceCollection = service.IServiceCollection(application)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits