]> git.donarmstrong.com Git - debbugs.git/commitdiff
allow debbugs-installsql to take a --dsn option
authorDon Armstrong <don@donarmstrong.com>
Tue, 27 Feb 2018 22:49:38 +0000 (14:49 -0800)
committerDon Armstrong <don@donarmstrong.com>
Tue, 27 Feb 2018 22:49:38 +0000 (14:49 -0800)
bin/debbugs-installsql

index 892aef4b10107eeebab39b0e192440f7fa9dada9..5957acbe536cf83b228fe1335c5de7464a3b3e52 100755 (executable)
@@ -83,6 +83,7 @@ my %options = (debug           => 0,
 
 GetOptions(\%options,
            'service|s=s',
+          'dsn=s',
            'sysconfdir|c=s',
            'install',
            'install_version_storage|install-version-storage',
@@ -120,8 +121,14 @@ if (exists $options{sysconfdir}) {
     }
 }
 
+if (not exists $options{dsn} or
+    not defined $options{dsn} or
+    not length $options{dsn}) {
+    $options{dsn} = 'dbi:Pg:service='.$options{service};
+}
+
 
-my $schema = Debbugs::DB->connect('dbi:Pg:service='.$options{service}) or
+my $schema = Debbugs::DB->connect($options{dsn}) or
     die "Unable to connect to database";