summaryrefslogtreecommitdiff
path: root/service/pixelated/config
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-01-19 13:58:11 +0100
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-01-19 13:59:05 +0100
commit93bc35da71c4eeb8e770ea266854b344e959655f (patch)
tree9d4cc21652d5fd2c049ca7255ae03edd895109e1 /service/pixelated/config
parentcd205b826ca9c1a65aee5d7005ce3853f57fcf0b (diff)
Issue #169: Allow custom home folder.
- add option --home /some/path to set a custom location for all user agent files.
Diffstat (limited to 'service/pixelated/config')
-rw-r--r--service/pixelated/config/app_factory.py13
-rw-r--r--service/pixelated/config/args.py2
2 files changed, 9 insertions, 6 deletions
diff --git a/service/pixelated/config/app_factory.py b/service/pixelated/config/app_factory.py
index 035a16b2..745db937 100644
--- a/service/pixelated/config/app_factory.py
+++ b/service/pixelated/config/app_factory.py
@@ -62,11 +62,12 @@ def update_info_sync_and_index_partial(sync_info_controller, search_engine, mail
return wrapper
-def init_leap_session(app):
+def init_leap_session(app, leap_home):
try:
leap_session = LeapSession.open(app.config['LEAP_USERNAME'],
app.config['LEAP_PASSWORD'],
- app.config['LEAP_SERVER_NAME'])
+ app.config['LEAP_SERVER_NAME'],
+ leap_home=leap_home)
except ConnectionError, error:
print("Can't connect to the requested provider", error)
sys.exit(1)
@@ -84,12 +85,12 @@ def look_for_user_key_and_create_if_cant_find(leap_session):
return wrapper
-def init_app(app):
- leap_session = init_leap_session(app)
+def init_app(app, leap_home):
+ leap_session = init_leap_session(app, leap_home)
soledad_querier = SoledadQuerier(soledad=leap_session.account._soledad)
tag_service = TagService()
- search_engine = SearchEngine(soledad_querier)
+ search_engine = SearchEngine(soledad_querier, agent_home=leap_home)
pixelated_mail_sender = MailSender(leap_session.account_email())
pixelated_mailboxes = Mailboxes(leap_session.account, soledad_querier)
@@ -130,7 +131,7 @@ def create_app(app, args):
listen_with_ssl(app, args)
else:
listen_without_ssl(app, args)
- reactor.callWhenRunning(lambda: init_app(app))
+ reactor.callWhenRunning(lambda: init_app(app, args.home))
reactor.run()
diff --git a/service/pixelated/config/args.py b/service/pixelated/config/args.py
index d08df929..5bb01d90 100644
--- a/service/pixelated/config/args.py
+++ b/service/pixelated/config/args.py
@@ -15,6 +15,7 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import argparse
+from pixelated.bitmask_libraries.config import DEFAULT_LEAP_HOME
def parse():
@@ -24,6 +25,7 @@ def parse():
parser.add_argument('--dispatcher-stdin', help='run in organization mode, the credentials will be read from stdin', default=False, action='store_true', dest='dispatcher_stdin')
parser.add_argument('--host', default='127.0.0.1', help='the host to run the user agent on')
parser.add_argument('--port', type=int, default=3333, help='the port to run the user agent on')
+ parser.add_argument('--home', help='The folder where the user agent stores its data. Defaults to ~/.leap', default=DEFAULT_LEAP_HOME)
parser.add_argument('-c', '--config', metavar='<configfile>', default=None, help='use specified file for credentials (for test purposes only)')
parser.add_argument('-sk', '--sslkey', metavar='<server.key>', default=None, help='use specified file for SSL key')
parser.add_argument('-sc', '--sslcert', metavar='<server.pem>', default=None, help='use specified file for SSL certificate')