X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;ds=inline;f=keydb_pg.c;h=0b58d28f6e753e4d1563db777105da0b8a9b99b3;hb=d1b4ba940d6bed575b40ac1026514c0b97d5128b;hp=ca7e35bac0545796f4fe32c768a4b47af2ec78d0;hpb=8e0907be1d73011075a99a0c029c56664e12843e;p=onak.git
diff --git a/keydb_pg.c b/keydb_pg.c
index ca7e35b..0b58d28 100644
--- a/keydb_pg.c
+++ b/keydb_pg.c
@@ -13,8 +13,7 @@
* more details.
*
* You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program. If not, see .
*/
#include
@@ -666,7 +665,7 @@ static void pg_cleanupdb(struct onak_dbctx *dbctx)
* this file are called in order to allow the DB to be initialized ready
* for access.
*/
-struct onak_dbctx *keydb_pg_init(bool readonly)
+struct onak_dbctx *keydb_pg_init(struct onak_db_config *dbcfg, bool readonly)
{
struct onak_dbctx *dbctx;
PGconn *dbconn;
@@ -675,14 +674,15 @@ struct onak_dbctx *keydb_pg_init(bool readonly)
if (dbctx == NULL) {
return NULL;
}
+ dbctx->config = dbcfg;
- dbconn = PQsetdbLogin(config.pg_dbhost, // host
+ dbconn = PQsetdbLogin(dbcfg->hostname, // host
NULL, // port
NULL, // options
NULL, // tty
- config.pg_dbname, // database
- config.pg_dbuser, //login
- config.pg_dbpass); // password
+ dbcfg->location, // database
+ dbcfg->username, //login
+ dbcfg->password); // password
if (PQstatus(dbconn) == CONNECTION_BAD) {
logthing(LOGTHING_CRITICAL, "Connection to database failed.");