From: Don Armstrong Date: Tue, 27 Feb 2018 22:49:38 +0000 (-0800) Subject: allow debbugs-installsql to take a --dsn option X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=e4b7198845771dbfc3fadbbe6c7f382dbb905e02 allow debbugs-installsql to take a --dsn option --- diff --git a/bin/debbugs-installsql b/bin/debbugs-installsql index 892aef4..5957acb 100755 --- a/bin/debbugs-installsql +++ b/bin/debbugs-installsql @@ -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";