diff --git a/settings.conf.example b/settings.conf.example deleted file mode 100644 index c6d2034..0000000 --- a/settings.conf.example +++ /dev/null @@ -1,8 +0,0 @@ -[ed_companion] -username = ed_email@domain.com -password = ed_password_goes_here - -[inara] -username = inara_username_goes_here -password = inara_password_goes_here - diff --git a/utils.py b/utils.py index bd15370..1e232e3 100644 --- a/utils.py +++ b/utils.py @@ -5,7 +5,7 @@ import os def get_settings(): """ Try to read the settings from file into ConfigParser object. - If the config file isn't found, initialize it and bail. + If the config file isn't found, initialize it. """ filename = os.path.join(config.app_dir, 'settings.conf') settings = ConfigParser() @@ -13,20 +13,19 @@ def get_settings(): if os.path.isfile(filename): settings.read(filename) else: - init_settings(settings, filename) + _init_settings(settings, filename) return settings -def init_settings(settings, filename): +def _init_settings(settings, filename): settings.add_section('ed_companion') settings.add_section('inara') - settings.set('ed_companion', 'username', '') - settings.set('ed_companion', 'password', '') - settings.set('inara', 'username', '') - settings.set('inara', 'password', '') - + settings.set('ed_companion', 'username', raw_input("Elite Username (email address): ")) + settings.set('ed_companion', 'password', raw_input("Elite Password: ")) + settings.set('inara', 'username', raw_input("Inara Username: ")) + settings.set('inara', 'password', raw_input("Inara Password: ")) + print "To change these settings later, edit " + filename + with open(filename, 'wb') as f: settings.write(f) - - raise Exception("Missing configuration. Please edit %s and run the program again." % filename)