]> granicus.if.org Git - postgis/commitdiff
Read configuration info from environment, if it's there.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 26 May 2010 16:26:15 +0000 (16:26 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 26 May 2010 16:26:15 +0000 (16:26 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5642 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-gui.c

index 71304f350dc995d2af4d76fef2e9bc56ca3669df..56fd91b3dadeacae9feec78657ba94057396fabf 100644 (file)
@@ -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)