diff -crB pgbouncer-1.5.2/etc/pgbouncer.ini pgbouncer-1.5.2-externaldbfile/etc/pgbouncer.ini
*** pgbouncer-1.5.2/etc/pgbouncer.ini	2013-02-11 14:07:28.000000000 +0100
--- pgbouncer-1.5.2-externaldbfile/etc/pgbouncer.ini	2013-02-11 13:28:51.633552643 +0100
***************
*** 25,30 ****
--- 25,36 ----
  [pgbouncer]
  
  ;;;
+ ;;; Additional database config from external file
+ ;;;
+ 
+ ;databases_file = /etc/pgbouncer/databases.ini
+ 
+ ;;;
  ;;; Administrative settings
  ;;;
  
diff -crB pgbouncer-1.5.2/lib/usual/cfparser.c pgbouncer-1.5.2-externaldbfile/lib/usual/cfparser.c
*** pgbouncer-1.5.2/lib/usual/cfparser.c	2012-01-19 12:48:19.000000000 +0100
--- pgbouncer-1.5.2-externaldbfile/lib/usual/cfparser.c	2013-02-11 13:36:58.482099761 +0100
***************
*** 332,344 ****
  
  bool cf_load_file(const struct CfContext *cf, const char *fn)
  {
  	struct LoaderCtx ctx = {
  		.cf = cf,
! 		.cur_sect = NULL,
  	};
  
  	bool ok = parse_ini_file(fn, load_handler, &ctx);
! 	if (ctx.cur_sect)
  		free(ctx.cur_sect);
  	return ok;
  }
--- 332,349 ----
  
  bool cf_load_file(const struct CfContext *cf, const char *fn)
  {
+ 	return cf_load_file_sect(cf, fn, NULL);
+ }
+ 
+ bool cf_load_file_sect(const struct CfContext *cf, const char *fn, const char* section)
+ {
  	struct LoaderCtx ctx = {
  		.cf = cf,
! 		.cur_sect = section
  	};
  
  	bool ok = parse_ini_file(fn, load_handler, &ctx);
! 	if (ctx.cur_sect && section == NULL)
  		free(ctx.cur_sect);
  	return ok;
  }
diff -crB pgbouncer-1.5.2/lib/usual/cfparser.h pgbouncer-1.5.2-externaldbfile/lib/usual/cfparser.h
*** pgbouncer-1.5.2/lib/usual/cfparser.h	2011-11-29 16:40:56.000000000 +0100
--- pgbouncer-1.5.2-externaldbfile/lib/usual/cfparser.h	2013-02-11 13:03:35.254546981 +0100
***************
*** 226,231 ****
--- 226,232 ----
   * Load config from file.
   */
  bool cf_load_file(const struct CfContext *cf, const char *fn) _MUSTCHECK;
+ bool cf_load_file_sect(const struct CfContext *cf, const char *fn, const char* section) _MUSTCHECK;
  
  /**
   * Get single value.
diff -crB pgbouncer-1.5.2/src/main.c pgbouncer-1.5.2-externaldbfile/src/main.c
*** pgbouncer-1.5.2/src/main.c	2012-05-29 09:56:29.000000000 +0200
--- pgbouncer-1.5.2-externaldbfile/src/main.c	2013-02-11 13:36:46.477790144 +0100
***************
*** 60,65 ****
--- 60,66 ----
  int cf_reboot;
  static char *cf_username;
  char *cf_config_file;
+ char *cf_databases_file;
  
  char *cf_listen_addr;
  int cf_listen_port;
***************
*** 162,167 ****
--- 163,169 ----
  CF_ABS("service_name", CF_STR, cf_jobname, CF_NO_RELOAD, NULL), /* alias for job_name */
  #endif
  CF_ABS("conffile", CF_STR, cf_config_file, 0, NULL),
+ CF_ABS("databases_file", CF_STR, cf_databases_file, 0, NULL),
  CF_ABS("logfile", CF_STR, cf_logfile, 0, ""),
  CF_ABS("pidfile", CF_STR, cf_pidfile, CF_NO_RELOAD, ""),
  CF_ABS("listen_addr", CF_STR, cf_listen_addr, CF_NO_RELOAD, ""),
***************
*** 301,307 ****
  		/* load users if needed */
  		if (cf_auth_type >= AUTH_TRUST)
  			load_auth_file(cf_auth_file);
! 		loaded = true;
  	} else if (!loaded) {
  		die("Cannot load config file");
  	} else {
--- 303,323 ----
  		/* load users if needed */
  		if (cf_auth_type >= AUTH_TRUST)
  			load_auth_file(cf_auth_file);
! 
! 		/* load external databases file */
! 		char buf[256];
! 		const char* dbfile = cf_get(&main_config, "pgbouncer", "databases_file", buf, sizeof(buf));
! 		if(dbfile != NULL) {
! 			log_info("Loading databases from '%s'\n", dbfile);
! 			ok = cf_load_file_sect(&main_config, dbfile, "databases");
! 			if(ok) {
! 				loaded = true;
! 			} else {
! 				die("Cannot load databases from external file '%s'", dbfile);
! 			}
! 		} else {
! 			loaded = true;
! 		}
  	} else if (!loaded) {
  		die("Cannot load config file");
  	} else {
