Add support for specifying MySQL port (issue #61)

git-svn-id: https://kippo.googlecode.com/svn/trunk@225 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster 2013-01-08 17:39:02 +00:00
parent 3a7bcc0ff5
commit 41363db9d4
2 changed files with 6 additions and 0 deletions

View File

@ -130,6 +130,7 @@ interact_port = 5123
#database = kippo
#username = kippo
#password = secret
#port = 3306
# XMPP Logging
#

View File

@ -32,11 +32,16 @@ class ReconnectingConnectionPool(adbapi.ConnectionPool):
class DBLogger(dblog.DBLogger):
def start(self, cfg):
if cfg.has_option('database_mysql', 'port'):
port = int(cfg.get('database_mysql', 'port'))
else:
port = 3306
self.db = ReconnectingConnectionPool('MySQLdb',
host = cfg.get('database_mysql', 'host'),
db = cfg.get('database_mysql', 'database'),
user = cfg.get('database_mysql', 'username'),
passwd = cfg.get('database_mysql', 'password'),
port = port,
cp_min = 1,
cp_max = 1)