IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34008


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

adding DBSERVER use instead of hardcoded name

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/nightly_science.pl

    r33863 r34008  
    20522052
    20532053sub init_gpc_db {
     2054    ## change to use the site.config setting, however may want to use replicated scidbs instead
     2055    my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
     2056    my $siteConfig = $ipprc->{_siteConfig};
    20542057    use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
    2055     my $dbserver = 'ippdb01';
     2058    # my $dbserver = 'ippdb01';
    20562059    my $dbuser = 'ippuser';
    20572060    my $dbpass = 'ippuser';
     2061    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
     2062    die "database configuration not set up" unless defined($dbserver);
    20582063    $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
    20592064                       "mysql_socket=" . DB_SOCKET(),
  • 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.