[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Tue Jun 10 17:34:12 UTC 2003


mwilkinson
Tue Jun 10 13:34:12 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv31682/MOBY

Modified Files:
	OntologyServer.pm 
Log Message:
missed one.  the OntologyServer also needs to read the environment variables

moby-live/Perl/MOBY OntologyServer.pm,1.12,1.13
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/06/10 01:30:11	1.12
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/06/10 17:34:12	1.13
@@ -81,11 +81,11 @@
     my %_attr_data = #     				DEFAULT    	ACCESSIBILITY
                   (
                     ontology =>     [undef,         'read/write'],
-                    database =>     ['mobycentral',         'read/write'],
-                    host    =>      ['localhost',         'read/write'],
-                    username=>      ['root',         'read/write'],
+                    database =>     [undef,         'read/write'],
+                    host    =>      [undef,         'read/write'],
+                    username=>      [undef,         'read/write'],
                     password=>      [undef,         'read/write'],
-                    port    =>      [3306,         'read/write'],
+                    port    =>      [undef,         'read/write'],
                     dbh     =>      [undef,         'read/write'],
                     
                     );
@@ -134,16 +134,17 @@
     $self->ontology eq 'namespace' && $self->database('mobynamespace');
     $self->ontology eq 'service' && $self->database('mobyservice');
     $self->ontology eq 'relationship' && $self->database('mobyrelationship');
+
+	my $host = $self->host?$self->host:$ENV{MOBY_CENTRAL_URL}; chomp $host;
+	my $username = $self->username?$self->username:$ENV{MOBY_CENTRAL_DBUSER}; chomp $username;
+	my $password = $self->password?$self->password:$ENV{MOBY_CENTRAL_DBPASS}; chomp $password;
+    my $port = $self->port?$self->port:$ENV{MOBY_CENTRAL_DBPORT}; chomp $port;
     
-    my ($dsn) = "DBI:mysql:".($self->database).":".($self->host).":".($self->port);
+    my ($dsn) = "DBI:mysql:".($self->database).":".($host).":".($port);
 
     my $dbh;
 #	$debug && &_LOG("connecting to db with params ",$self->database, $self->username, $self->password,"\n");
-	if ($self->password){
-    	$dbh = DBI->connect($dsn, $self->username, $self->password, {RaiseError => 1}) or die "can't connect to database";
-	} else {
-    	$dbh = DBI->connect($dsn, $self->username,undef, {RaiseError => 1}) or die "can't connect to database";
-	}
+    $dbh = DBI->connect($dsn, $username, $password, {RaiseError => 1}) or die "can't connect to database";
 #	$debug && &_LOG("CONNECTED!\n");
     if ($dbh){
         $self->dbh($dbh);




More information about the MOBY-guts mailing list