summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/pixelated/config/__init__.py20
-rw-r--r--service/pixelated/config/initialize_leap.py13
-rw-r--r--service/pixelated/config/leap_cert.py8
-rw-r--r--service/pixelated/config/register.py2
4 files changed, 24 insertions, 19 deletions
diff --git a/service/pixelated/config/__init__.py b/service/pixelated/config/__init__.py
index 2706cd6f..e9953ded 100644
--- a/service/pixelated/config/__init__.py
+++ b/service/pixelated/config/__init__.py
@@ -26,28 +26,22 @@ from pixelated.config.events_server import init_events_server
from pixelated.config.loading_page import loading
from pixelated.config.register import register
from pixelated.config.logging_setup import init_logging
-from pixelated.config.leap_cert import init_leap_cert
from pixelated.config.soledad import init_soledad_and_user_key
from twisted.internet import reactor
from twisted.internet.threads import deferToThread
-
-# monkey patching some specifics
-import pixelated.support.ext_protobuf
-import pixelated.support.ext_sqlcipher
-import pixelated.support.ext_esmtp_sender_factory
-import pixelated.support.ext_fetch
-import pixelated.support.ext_sync
-import pixelated.support.ext_keymanager_fetch_key
-import pixelated.support.ext_requests_urllib3
from pixelated.support.error_handler import error_handler
+from pixelated.config.initialize_leap import initialize_leap
+
def initialize():
args = parse_args()
- app = App()
-
init_logging(debug=args.debug)
- init_leap_cert(args)
+
+ initialize_leap(args.leap_provider_cert,
+ args.leap_provider_cert_fingerprint)
+
+ app = App()
if args.register:
register(*args.register)
diff --git a/service/pixelated/config/initialize_leap.py b/service/pixelated/config/initialize_leap.py
new file mode 100644
index 00000000..e393ec3f
--- /dev/null
+++ b/service/pixelated/config/initialize_leap.py
@@ -0,0 +1,13 @@
+from pixelated.config.leap_cert import init_leap_cert
+
+
+def initialize_leap(leap_provider_cert, leap_provider_cert_fingerprint):
+ import pixelated.support.ext_protobuf
+ import pixelated.support.ext_sqlcipher
+ import pixelated.support.ext_esmtp_sender_factory
+ import pixelated.support.ext_fetch
+ import pixelated.support.ext_sync
+ import pixelated.support.ext_keymanager_fetch_key
+ import pixelated.support.ext_requests_urllib3
+
+ init_leap_cert(leap_provider_cert, leap_provider_cert_fingerprint)
diff --git a/service/pixelated/config/leap_cert.py b/service/pixelated/config/leap_cert.py
index 568f76d9..20251d7c 100644
--- a/service/pixelated/config/leap_cert.py
+++ b/service/pixelated/config/leap_cert.py
@@ -17,10 +17,10 @@
import pixelated.bitmask_libraries.certs as certs
-def init_leap_cert(args):
- if args.leap_provider_cert_fingerprint is None:
- certs.LEAP_CERT = args.leap_provider_cert or True
+def init_leap_cert(leap_provider_cert, leap_provider_cert_fingerprint):
+ if leap_provider_cert_fingerprint is None:
+ certs.LEAP_CERT = leap_provider_cert or True
certs.LEAP_FINGERPRINT = None
else:
- certs.LEAP_FINGERPRINT = args.leap_provider_cert_fingerprint
+ certs.LEAP_FINGERPRINT = leap_provider_cert_fingerprint
certs.LEAP_CERT = False
diff --git a/service/pixelated/config/register.py b/service/pixelated/config/register.py
index e1a07eca..9a6a5746 100644
--- a/service/pixelated/config/register.py
+++ b/service/pixelated/config/register.py
@@ -14,8 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import re
-import os
-import os.path
import getpass
import logging
import pixelated.bitmask_libraries.session as LeapSession