summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@thoughtworks.com>2014-10-22 18:28:10 +0200
committerBruno Wagner <bwagner@thoughtworks.com>2014-10-22 18:28:23 +0200
commit23a1770d1778c7d150016f4f23a3b95d74680274 (patch)
tree99b139194e468781f7be28681fcd2ff797af1fd3
parenta2e4f6e4816d4f0d92888b577b76153cf8c65e19 (diff)
Credentials will be asked for when spinning up the user agent now, if you want to use the config file you have to explicitly set the --config=file switch on the pixelated_user_agent
-rw-r--r--service/pixelated/config/credentials_prompt.py7
-rw-r--r--service/pixelated/runserver.py14
2 files changed, 21 insertions, 0 deletions
diff --git a/service/pixelated/config/credentials_prompt.py b/service/pixelated/config/credentials_prompt.py
new file mode 100644
index 00000000..34369405
--- /dev/null
+++ b/service/pixelated/config/credentials_prompt.py
@@ -0,0 +1,7 @@
+import getpass
+
+def run():
+ provider = raw_input('Which provider do you want to connect to:\n')
+ username = raw_input('What\'s your username registered on the provider:\n')
+ password = getpass.getpass('Type your password:\n')
+ return provider, username, password
diff --git a/service/pixelated/runserver.py b/service/pixelated/runserver.py
index 92266dba..7e12b639 100644
--- a/service/pixelated/runserver.py
+++ b/service/pixelated/runserver.py
@@ -15,12 +15,14 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import os
+import sys
import os.path
import crochet
from flask import Flask
from leap.common.events import server as events_server
from pixelated.config import app_factory
import pixelated.config.args as input_args
+import pixelated.config.credentials_prompt as credentials_prompt
import pixelated.bitmask_libraries.register as leap_register
import pixelated.config.reactor_manager as reactor_manager
import pixelated.support.ext_protobuf # monkey patch for protobuf in OSX
@@ -49,6 +51,18 @@ def setup():
server_name = app.config['LEAP_SERVER_NAME']
leap_register.register_new_user(args.register, server_name)
else:
+
+ if args.dispatcher:
+ raise Exception('Dispatcher mode not implemented yet')
+ elif args.config is not None:
+ config_file = os.path.abspath(args.config)
+ app.config.from_pyfile(config_file)
+ else:
+ provider, user, password = credentials_prompt.run()
+ app.config['LEAP_SERVER_NAME'] = provider
+ app.config['LEAP_USERNAME'] = user
+ app.config['LEAP_PASSWORD'] = password
+
app_factory.create_app(debug_enabled, app)
finally:
reactor_manager.stop_reactor_on_exit()