IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 13, 2012, 4:45:18 PM (14 years ago)
Author:
mhuber
Message:

adding DBSERVER use instead of hardcoded name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/regpeek.pl

    r32419 r34008  
    33use DBI;
    44use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     5use PS::IPP::Config 1.0.1 qw( :standard );
    56
    67my $dbname = 'gpc1';
     
    6566
    6667sub init_gpc_db {
     68    ## change to use the site.config setting now, however may want to use replicated scidbs instead
     69    my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
     70    my $siteConfig = $ipprc->{_siteConfig};
    6771    use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
    68     my $dbserver = 'ippdb01';
     72    # my $dbserver = 'ippdb01';
    6973    my $dbuser = 'ippuser';
    7074    my $dbpass = 'ippuser';
     75    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
     76    die "database configuration not set up" unless defined($dbserver);
    7177    $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
    7278                       "mysql_socket=" . DB_SOCKET(),
    7379                       ${dbuser},${dbpass},
    74 { RaiseError => 1, AutoCommit => 1}
     80                       { RaiseError => 1, AutoCommit => 1}
    7581        ) or die "Unable to connect to database $DBI::errstr\n";
    7682return($db);
Note: See TracChangeset for help on using the changeset viewer.