diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/pixelated/application.py | 9 | ||||
-rw-r--r-- | service/pixelated/config/arguments.py (renamed from service/pixelated/config/args.py) | 0 | ||||
-rw-r--r-- | service/pixelated/config/logger.py (renamed from service/pixelated/config/logging_setup.py) | 2 | ||||
-rw-r--r-- | service/pixelated/maintenance.py | 17 | ||||
-rw-r--r-- | service/test/unit/config/test_credentials.py | 4 |
5 files changed, 11 insertions, 21 deletions
diff --git a/service/pixelated/application.py b/service/pixelated/application.py index f36612f4..5914d51f 100644 --- a/service/pixelated/application.py +++ b/service/pixelated/application.py @@ -24,12 +24,11 @@ from twisted.internet import ssl from OpenSSL import SSL from OpenSSL import crypto -from pixelated.config import app_factory -from pixelated.config.args import parse_user_agent_args +from pixelated.config import arguments from pixelated.resources import loading_page from pixelated.config.initialize_leap import initialize_leap from pixelated.config.register import register -from pixelated.config.logging_setup import init_logging +from pixelated.config import logger, app_factory @defer.inlineCallbacks @@ -63,8 +62,8 @@ def _ssl_options(sslkey, sslcert): def initialize(): - args = parse_user_agent_args() - init_logging(debug=args.debug) + args = arguments.parse_user_agent_args() + logger.init(debug=args.debug) if args.register: register(*args.register) diff --git a/service/pixelated/config/args.py b/service/pixelated/config/arguments.py index 2c7470e2..2c7470e2 100644 --- a/service/pixelated/config/args.py +++ b/service/pixelated/config/arguments.py diff --git a/service/pixelated/config/logging_setup.py b/service/pixelated/config/logger.py index 932f746d..52f3f3a5 100644 --- a/service/pixelated/config/logging_setup.py +++ b/service/pixelated/config/logger.py @@ -19,7 +19,7 @@ import os from twisted.python import log -def init_logging(debug=False): +def init(debug=False): debug_enabled = debug or os.environ.get('DEBUG', False) logging_level = logging.DEBUG if debug_enabled else logging.INFO log_format = "%(asctime)s [%(name)s] %(levelname)s %(message)s" diff --git a/service/pixelated/maintenance.py b/service/pixelated/maintenance.py index c3e021b4..756ad435 100644 --- a/service/pixelated/maintenance.py +++ b/service/pixelated/maintenance.py @@ -15,27 +15,18 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. from mailbox import Maildir -from pixelated.config.args import parse_maintenance_args -from pixelated.config.initialize_leap import initialize_leap -from pixelated.config.logging_setup import init_logging from twisted.internet import reactor, defer from twisted.internet.threads import deferToThread +from pixelated.config.initialize_leap import initialize_leap +from pixelated.config import logger, arguments from leap.mail.imap.fields import WithMsgFields -# 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_keymanager_fetch_key -import pixelated.support.ext_requests_urllib3 - def initialize(): - args = parse_maintenance_args() + args = arguments.parse_maintenance_args() - init_logging(debug=args.debug) + logger.init(debug=args.debug) leap_session = initialize_leap( args.leap_provider_cert, diff --git a/service/test/unit/config/test_credentials.py b/service/test/unit/config/test_credentials.py index 61cfac53..6c25c5bf 100644 --- a/service/test/unit/config/test_credentials.py +++ b/service/test/unit/config/test_credentials.py @@ -2,7 +2,7 @@ import json import unittest import sys from mockito import mock, when -from pixelated.config.args import parse_user_agent_args +from pixelated.config import arguments from pixelated.config import credentials @@ -19,7 +19,7 @@ class TestReadCredentials(unittest.TestCase): try: sys.argv = ['tmp/does_not_exist', '--organization-mode'] - args = parse_user_agent_args() + args = arguments.parse_user_agent_args() provider, user, password = credentials.read(args.organization_mode, 'not_used') |