From ae2365b10eb1aee42e1cf4c685e931d8f159c5f8 Mon Sep 17 00:00:00 2001 From: Ovidiu Constantin Date: Wed, 23 Nov 2011 18:19:01 +0200 Subject: [PATCH] * adding support for MySQL --- electrum.conf.sample | 10 +++++++++- server.py | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/electrum.conf.sample b/electrum.conf.sample index 83f8aea..dac7630 100644 --- a/electrum.conf.sample +++ b/electrum.conf.sample @@ -1,5 +1,5 @@ [server] -host = 127.0.0.1 +host = localhost port = 50000 password = secret banner = Welcome to Electrum! @@ -7,3 +7,11 @@ banner = Welcome to Electrum! [database] type = sqlite3 database = electrum.sqlite + +# type = MySQLdb +# database = electrum +# username = electrum +# password = secret + +# type = psycopg2 +# database = electrum diff --git a/server.py b/server.py index bb939f5..4cd4b5b 100755 --- a/server.py +++ b/server.py @@ -509,7 +509,12 @@ if __name__ == '__main__': conf = DataStore.CONFIG_DEFAULTS args, argv = readconf.parse_argv( [], conf) args.dbtype= config.get('database','type') - args.connect_args = {'database' : config.get('database','database') } + if args.dbtype == 'sqlite3': + args.connect_args = { 'database' : config.get('database','database') } + elif args.dbtype == 'MySQLdb': + args.connect_args = { 'db' : config.get('database','database'), 'user' : config.get('database','user'), 'passwd' : config.get('database','pass') } + elif args.dbtype == 'psycopg2': + args.connect_args = { 'database' : config.get('database','database') } store = MyStore(args) thread.start_new_thread(listen_thread, (store,)) -- 1.7.1