Mercurial > urweb
diff src/postgres.sml @ 1564:da11f7b18067
Add an URWEB_PQ_CON environment variable, which overrides the PostgreSQL connection string.
author | Austin Seipp <as@hacks.yi.org> |
---|---|
date | Fri, 23 Sep 2011 23:11:59 -0500 |
parents | daf71c76707e |
children | 8128fcb2d4a4 |
line wrap: on
line diff
--- a/src/postgres.sml Thu Sep 22 09:51:06 2011 -0400 +++ b/src/postgres.sml Fri Sep 23 23:11:59 2011 -0500 @@ -476,9 +476,11 @@ string "static void uw_db_init(uw_context ctx) {", newline, - string "PGconn *conn = PQconnectdb(\"", + string "char *env_db_str = getenv(\"URWEB_PQ_CON\");", + newline, + string "PGconn *conn = PQconnectdb(env_db_str == NULL ? \"", string (String.toCString dbstring), - string "\");", + string "\" : env_db_str);", newline, string "if (conn == NULL) uw_error(ctx, FATAL, ", string "\"libpq can't allocate a connection.\");",