IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 20, 2012, 12:22:52 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20120601
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120601

  • branches/eam_branches/ipp-20120601/tools/regpeek.pl

    r32419 r34049  
    33use DBI;
    44use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     5use PS::IPP::Config 1.0.1 qw( :standard );
     6
     7my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
     8my $siteConfig = $ipprc->{_siteConfig};
    59
    610my $dbname = 'gpc1';
     
    6569
    6670sub init_gpc_db {
     71    ## change to use the siteConfig setting, while readonly probably do not want to use a readonly replicated DB incase it gets behind
    6772    use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
    68     my $dbserver = 'ippdb01';
    69     my $dbuser = 'ippuser';
    70     my $dbpass = 'ippuser';
     73    #my $dbserver = 'ippdb01';
     74    #my $dbuser = 'ippuser';
     75    #my $dbpass = 'ippuser';
     76    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
     77    my $dbuser = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBUSER");
     78    my $dbpass = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBPASSWORD");
     79    die "database configuration not set up" unless defined($dbserver);
     80    die "database configuration not set up" unless defined($dbuser);
     81    die "database configuration not set up" unless defined($dbpass);
    7182    $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
    7283                       "mysql_socket=" . DB_SOCKET(),
    7384                       ${dbuser},${dbpass},
    74 { RaiseError => 1, AutoCommit => 1}
     85                       { RaiseError => 1, AutoCommit => 1}
    7586        ) or die "Unable to connect to database $DBI::errstr\n";
    7687return($db);
Note: See TracChangeset for help on using the changeset viewer.