Be more explicit for ENV defaults, to prevent confusion with simple database names...
authorGreg Sabino Mullane <greg@endpoint.com>
Thu, 26 May 2011 02:01:17 +0000 (22:01 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Thu, 26 May 2011 02:01:17 +0000 (22:01 -0400)
bucardo_ctl

index bcc34ec7d12fff2f5dcd183a78c088ab89b2f017..f9eadd752e91f4015bd2b899aef8192871e99526 100755 (executable)
@@ -742,8 +742,8 @@ sub add_database {
         type                     dbtype               0                postgres
         dbname                   dbname               0                $item_name
         user|dbuser|pguser       dbuser               0                bucardo
-        host|dbhost|pghost       dbhost               0                PGHOSTADDR|PGHOST
-        port|dbport|pgport       dbport               numeric          PGPORT
+        host|dbhost|pghost       dbhost               0                ENV:PGHOSTADDR|PGHOST
+        port|dbport|pgport       dbport               numeric          ENV:PGPORT
         pass|dbpass              dbpass               0                null
         conn|dbconn|pgconn       dbconn               0                null
         stat|status              status               =active|inactive null
@@ -7717,8 +7717,8 @@ sub process_simple_args {
             $item{$name} = [$dbcol,$flag,$default];
             $alias{$name} = $alias;
         }
-        ## Got all caps? Possible environment variable default
-        if ($default !~ /[a-z]/ and $default =~ /[A-Z]/) {
+        ## Process environment variable default
+        if ($default =~ s/^ENV://) {
             for my $env (split /\|/ => $default) {
                 if ($ENV{$env}) {