Refactoring the names used in config file

This commit is contained in:
yegle 2012-12-10 00:52:51 -05:00
parent a61c718a33
commit dda8326592
3 changed files with 16 additions and 23 deletions

View file

@ -102,10 +102,6 @@ if __name__ == '__main__':
with open('config.json', 'rb') as f:
config = json.load(f)
SERVER = config['server']
PORT = config['server_port']
KEY = config['password']
parser = argparse.ArgumentParser(
description='ShadowSocks Server'
)
@ -116,12 +112,14 @@ if __name__ == '__main__':
sys.exit(1)
args = parser.parse_args()
d = vars(args)
_config = dict((k,d[k]) for k in d if d[k])
if args.key:
KEY = args.key
config.update(_config)
if args.port:
PORT = args.port
SERVER = config['server']
PORT = config['port']
KEY = config['password']
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S', filemode='a+')