summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-08-28 17:21:49 -0300
committerDuda Dornelles <ddornell@thoughtworks.com>2014-08-28 17:21:49 -0300
commite8ea69364eace4ee0ad87c779bfaf20b0bc353ac (patch)
tree6f7d5a5224efa31b898e08a53602725baebfed2b /service
parent8d720d413122ddcba43cc52ceaa13513ac23ac37 (diff)
moving user agent initialization (mail service, leap_session, app_config) to inside setup so it doesn't happen in the tests
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/user_agent.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/service/pixelated/user_agent.py b/service/pixelated/user_agent.py
index 3e9eadaf..9626f739 100644
--- a/service/pixelated/user_agent.py
+++ b/service/pixelated/user_agent.py
@@ -32,9 +32,7 @@ static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", ".
if not os.path.exists(static_folder):
static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "app"))
app = Flask(__name__, static_url_path='', static_folder=static_folder)
-app.config.from_pyfile(os.path.join(os.environ['HOME'], '.pixelated'))
-leap_session = open_leap_session(app.config['LEAP_USERNAME'], app.config['LEAP_PASSWORD'], app.config['LEAP_SERVER_NAME'])
-mail_service = MailService(leap_session)
+
def respond_json(entity):
@@ -143,6 +141,10 @@ def index():
def setup():
debug_enabled = os.environ.get('DEBUG', False)
reactor_manager.start_reactor(logging=debug_enabled)
+ app.config.from_pyfile(os.path.join(os.environ['HOME'], '.pixelated'))
+ leap_session = open_leap_session(app.config['LEAP_USERNAME'], app.config['LEAP_PASSWORD'], app.config['LEAP_SERVER_NAME'])
+ mail_service = MailService(leap_session)
+ global mail_service
mail_service.start()
app.run(host=app.config['HOST'], debug=debug_enabled, port=app.config['PORT'])