IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34018 for trunk/ippScripts


Ignore:
Timestamp:
Jun 15, 2012, 1:21:25 PM (14 years ago)
Author:
mhuber
Message:

adding change for readonly DBSERVER,DBUSER,DBPASSWORD use instead of being hardcoded

File:
1 edited

Legend:

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

    r34008 r34018  
    3232    exit($PS_EXIT_CONFIG_ERROR);
    3333}
     34
     35## for DB connection, want to use siteConfig DB settings
     36my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
     37my $siteConfig = $ipprc->{_siteConfig};
    3438
    3539my $db;
     
    20522056
    20532057sub 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};
     2058    ## change to use the siteConfig setting, while readonly probably do not want to use a readonly replicated DB incase it gets behind
     2059    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
     2060    my $dbuser = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBUSER");
     2061    my $dbpass = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBPASSWORD");
     2062    die "database configuration not set up" unless defined($dbserver);
     2063    die "database configuration not set up" unless defined($dbuser);
     2064    die "database configuration not set up" unless defined($dbpass);
     2065    #my $dbserver = 'ippdb01';
     2066    #my $dbuser = 'ippuser';
     2067    #my $dbpass = 'ippuser';
    20572068    use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
    2058     # my $dbserver = 'ippdb01';
    2059     my $dbuser = 'ippuser';
    2060     my $dbpass = 'ippuser';
    2061     my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
    2062     die "database configuration not set up" unless defined($dbserver);
    20632069    $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
    20642070                       "mysql_socket=" . DB_SOCKET(),
Note: See TracChangeset for help on using the changeset viewer.