From 3ed79dd9ed49ebfcb46acec3f2fa6fb32eee9b6a Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Wed, 26 May 2010 16:26:15 +0000 Subject: [PATCH] Read configuration info from environment, if it's there. git-svn-id: http://svn.osgeo.org/postgis/trunk@5642 b70326c6-7e19-0410-871a-916f4a2858ee --- loader/shp2pgsql-gui.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/loader/shp2pgsql-gui.c b/loader/shp2pgsql-gui.c index 71304f350..56fd91b3d 100644 --- a/loader/shp2pgsql-gui.c +++ b/loader/shp2pgsql-gui.c @@ -1225,16 +1225,24 @@ main(int argc, char *argv[]) { char c; - /* Parse command line options and set configuration */ + /* Set default configuration */ config = malloc(sizeof(SHPLOADERCONFIG)); set_config_defaults(config); /* Here we override any defaults for the GUI */ config->createindex = 1; + /* Prepare our shape connection */ conn = malloc(sizeof(SHPCONNECTIONCONFIG)); memset(conn, 0, sizeof(SHPCONNECTIONCONFIG)); + /* Read any environment values */ + conn->port = getenv("PGPORT"); + conn->username = getenv("PGUSER"); + conn->database = getenv("PGDATABASE"); + conn->host = getenv("PGHOST"); + + /* Over-ride the environment with any command line options */ while ((c = pgis_getopt(argc, argv, "U:p:W:d:h:")) != -1) { switch (c) -- 2.40.0