diff options
| author | Kali Kaneko <kali@leap.se> | 2015-02-19 00:58:17 -0400 | 
|---|---|---|
| committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-02-20 17:35:29 -0300 | 
| commit | 6218f04f08c90b6cd3b250d725e0cb55a81b505f (patch) | |
| tree | 536f22270ea71f27b511362319ef5acf86fa4178 | |
| parent | aebfcb34ca43e1a2da9bc924ea7a1af17b0534fb (diff) | |
change environment variable for mail config
| -rw-r--r-- | mail/docs/hacking.rst | 6 | ||||
| -rw-r--r-- | mail/src/leap/mail/imap/service/imap-server.tac | 38 | 
2 files changed, 13 insertions, 31 deletions
| diff --git a/mail/docs/hacking.rst b/mail/docs/hacking.rst index daa3762..bd9f792 100644 --- a/mail/docs/hacking.rst +++ b/mail/docs/hacking.rst @@ -33,7 +33,7 @@ Profiling  If using ``twistd`` to launch the server, you can use twisted profiling  capabities:: -  LEAP_MAIL_CONF=~/.leapmailrc twistd --profile=/tmp/mail-profiling -n -y imap-server.tac +  LEAP_MAIL_CONFIG=~/.leapmailrc twistd --profile=/tmp/mail-profiling -n -y imap-server.tac  ``--profiler`` option allows you to select different profilers (default is  "hotshot"). @@ -63,7 +63,7 @@ need a config with this info::    uuid = "deadbeefdeadabad"    passwd = "foobar" # Optional -In the ``LEAP_MAIL_CONF`` enviroment variable. If you do not specify a password +In the ``LEAP_MAIL_CONFIG`` enviroment variable. If you do not specify a password  parameter, you'll be prompted for it.  In order to get the user uid (uuid), look into the @@ -72,7 +72,7 @@ provider at least once.  Run the twisted service:: -  LEAP_IMAP_CONFIG=~/.leapmailrc twistd -n -y imap-server.tac +  LEAP_MAIL_CONFIG=~/.leapmailrc twistd -n -y imap-server.tac  Now you can telnet into your local IMAP server and read your mail like a real  programmerâ„¢:: diff --git a/mail/src/leap/mail/imap/service/imap-server.tac b/mail/src/leap/mail/imap/service/imap-server.tac index 651f71b..49a29b1 100644 --- a/mail/src/leap/mail/imap/service/imap-server.tac +++ b/mail/src/leap/mail/imap/service/imap-server.tac @@ -23,9 +23,9 @@ For now, and for debugging/testing purposes, you need  to pass a config file with the following structure:  [leap_mail] -userid = "user@provider" -uuid = "deadbeefdeadabad" -passwd = "supersecret" # optional, will get prompted if not found. +userid = 'user@provider' +uuid = 'deadbeefdeadabad' +passwd = 'supersecret' # optional, will get prompted if not found.  """  import ConfigParser  import getpass @@ -53,38 +53,17 @@ def initialize_soledad(uuid, email, passwd,      :param tempdir: path to temporal dir      :rtype: Soledad instance      """ -    # XXX TODO unify with an authoritative source of mocks -    # for soledad (or partial initializations). -    # This is copied from the imap tests. -      server_url = "http://provider"      cert_file = "" -    class Mock(object): -        def __init__(self, return_value=None): -            self._return = return_value - -        def __call__(self, *args, **kwargs): -            return self._return - -    class MockSharedDB(object): - -        get_doc = Mock() -        put_doc = Mock() -        lock = Mock(return_value=('atoken', 300)) -        unlock = Mock(return_value=True) - -        def __call__(self): -            return self - -    Soledad._shared_db = MockSharedDB()      soledad = Soledad(          uuid,          passwd,          secrets,          localdb,          server_url, -        cert_file) +        cert_file, +        syncable=False)      return soledad @@ -95,9 +74,9 @@ def initialize_soledad(uuid, email, passwd,  print "[+] Running LEAP IMAP Service" -bmconf = os.environ.get("LEAP_MAIL_CONF", "") +bmconf = os.environ.get("LEAP_MAIL_CONFIG", "")  if not bmconf: -    print ("[-] Please set LEAP_MAIL_CONF environment variable " +    print ("[-] Please set LEAP_MAIL_CONFIG environment variable "             "pointing to your config.")      sys.exit(1) @@ -131,6 +110,7 @@ tempdir = "/tmp/"  # Ad-hoc soledad/keymanager initialization. +print "[~] user:", userid  soledad = initialize_soledad(uuid, userid, passwd, secrets,                               localdb, gnupg_home, tempdir)  km_args = (userid, "https://localhost", soledad) @@ -144,6 +124,8 @@ km_kwargs = {  }  keymanager = KeyManager(*km_args, **km_kwargs) +# XXX Do we need to wait until keymanager is properly initialized? +  ##################################################  # Ok, let's expose the application object for the twistd application | 
