Ignore:
Timestamp:
Feb 20, 2010, 4:31:08 AM (15 years ago)
Author:
mitchb
Message:
* Don't put SQL passwords in command-line arguments.
* When using sqlalchemy, use ~/.my.cnf instead of hardcoding the SQL
  password.
  (Merge of r1477:1478 from locker-dev to trunk, originally from xavid)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/locker/deploy/bin/turbogears

    r1422 r1479  
    133133
    134134# Put in the sqldb
    135 system(qw(sed -ri),'s/^sql(alchemy|object)\.dburi(.*)$/#sql\1.dburi\2\nsqlalchemy.dburi="mysql:\/\/' . uri_escape($sqluser) . ":" . uri_escape($sqlpass) . "\@$sqlhost\\/$sqldb\"/","$name/dev.cfg", "$name/sample-prod.cfg") == 0 or die "sed db failed!";
     135if ($orm eq "sqlobject") {
     136    my $uriuser = uri_escape($sqluser);
     137    my $uripass = uri_escape($sqlpass);
     138    foreach my $fil (("$name/dev.cfg", "$name/sample-prod.cfg"))
     139    {
     140        open my $in, '<', $fil or die "Can't read old file: $!";
     141        open my $out, '>', "$fil.new" or die "Can't write new file: $!";
     142
     143        while (<$in>) {
     144            s/^sqlobject\.dburi(.*)$/#sqlobject.dburi\2\nsqlobject.dburi="mysql:\/\/$uriuser:$uripass\@$sqlhost\/$sqldb"/;
     145            print $out $_;
     146        }
     147        close $out;
     148        rename "$fil.new", $fil
     149            or die "Cannot rename: $!";
     150    }
     151} else {
     152    system(qw(sed -ri),"s&^sql(alchemy|object)\.dburi(.*)\$&#sql\\1.dburi\\2\\nsql\\1.dburi=\"mysql://$sqlhost/$sqldb?read_default_file=~/.my.cnf\"&","$name/dev.cfg", "$name/sample-prod.cfg") == 0 or die "sed db failed!";
     153}
    136154system(qw(sed -ri),'s/^#? *autoreload\.on.*$/autoreload.on = False # breaks the scripts flup setup/',"$name/dev.cfg") == 0 or die "sed autoreload failed!";
    137155my $addrendescsl = $addrend;
Note: See TracChangeset for help on using the changeset viewer.