Browse Source

tracim endpoint for email fetcher use now tracim config

Guénaël Muller 7 years ago
parent
commit
e2eb1cac7c
2 changed files with 5 additions and 4 deletions
  1. 2 1
      tracim/tracim/lib/daemons.py
  2. 3 3
      tracim/tracim/lib/email_fetcher.py

+ 2 - 1
tracim/tracim/lib/daemons.py View File

@@ -167,7 +167,8 @@ class MailFetcherDaemon(Daemon):
167 167
             user=cfg.EMAIL_REPLY_IMAP_USER,
168 168
             password=cfg.EMAIL_REPLY_IMAP_PASSWORD,
169 169
             folder=cfg.EMAIL_REPLY_IMAP_FOLDER,
170
-            delay=cfg.EMAIL_REPLY_DELAY
170
+            delay=cfg.EMAIL_REPLY_DELAY,
171
+            endpoint=cfg.WEBSITE_BASE_URL + "/events"
171 172
         )
172 173
         self._fetcher.run()
173 174
 

+ 3 - 3
tracim/tracim/lib/email_fetcher.py View File

@@ -95,16 +95,16 @@ def find_key_from_mail_adress(mail_address:str) -> Union[str,None]:
95 95
 
96 96
 class MailFetcher(object):
97 97
 
98
-    def __init__(self,host,port,user,password,folder,delay):
98
+    def __init__(self,host,port,user,password,folder,delay,endpoint):
99 99
         self._connection = None
100 100
         self._mails = []
101
-
102 101
         self.host = host
103 102
         self.port = port
104 103
         self.user = user
105 104
         self.password = password
106 105
         self.folder = folder
107 106
         self.delay = delay
107
+        self.endpoint = endpoint
108 108
 
109 109
         self._is_active = True
110 110
 
@@ -181,5 +181,5 @@ class MailFetcher(object):
181 181
                        "content": decoded_mail['body']
182 182
                    }}
183 183
 
184
-            requests.post('http://localhost:8080/events',json=msg)
184
+            requests.post(self.endpoint,json=msg)
185 185
             pass