From 10a3f1b1f6b68a4e9ebe23f2dbebdcb826390372 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 18 Feb 2012 23:33:23 +0100 Subject: [PATCH] Move the database configuration to the config file. --- bigscreen/ccbs_bigscreen.cpp | 9 ++++++++- bigscreen/theme.config | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bigscreen/ccbs_bigscreen.cpp b/bigscreen/ccbs_bigscreen.cpp index eeee86c..40d5bad 100644 --- a/bigscreen/ccbs_bigscreen.cpp +++ b/bigscreen/ccbs_bigscreen.cpp @@ -206,7 +206,14 @@ int main(int argc, char **argv) try { init_freetype(); set_screen_size(screen_width, screen_height); - pqxx::connection conn("dbname=ccbs host=www.positivegaming.com user=ccbs password=GeT|>>B_"); + + char connstr[1024]; + snprintf(connstr, sizeof(connstr), "dbname=%s host=%s user=%s password=%s", + get_theme_config("db", "dbname").c_str(), + get_theme_config("db", "host").c_str(), + get_theme_config("db", "user").c_str(), + get_theme_config("db", "password").c_str()); + pqxx::connection conn(connstr); FlagTrigger tournament_changed(conn, "active_tournament"); FlagTrigger rounds_changed(conn, "active_groups"); diff --git a/bigscreen/theme.config b/bigscreen/theme.config index bee59aa..2ac2167 100644 --- a/bigscreen/theme.config +++ b/bigscreen/theme.config @@ -10,6 +10,12 @@ screen.fullscreen=0 screen.logical_width=800 screen.logical_height=600 +# Database configuration. +db.dbname=ccbs +db.host=www.positivegaming.com +db.user=ccbs +db.password=GeT|>>B_ + # Theme. default.font=/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf;/usr/share/fonts/truetype/freefont/FreeSerif.ttf;arialuni.ttf default.red=255 -- 2.39.2