Commit 3aa7f64b authored by Marek Szuba's avatar Marek Szuba
Browse files

MultiTestDB: add an environment variable for overriding test-DB prefix

Until now, MultiTestDB would prefix the names of test databases it
creates with the local user name as determined by looking at the
environment variables: LOGNAME and USER, in the order as written here.
There are the following problems with this approach:
 - it leaks local user names to the database system and by extension to
   everyone who can access them,
 - in the event of said local user names being different from farm ones
   it makes it more difficult to identify to whom a specific database
To address these issues the present commit introduces a new environment
variable called ENSEMBL_TESTDB_PREFIX which when defined takes
precedence over LOGNAME. Now anyone running tests on their local machine
can set that variable to their farm user name.
parent 1e5cfcec
......@@ -781,7 +781,11 @@ sub create_db_name {
# Create a unique name using host and date / time info
my $db_name = sprintf(
( exists $ENV{'LOGNAME'} ? $ENV{'LOGNAME'} : $ENV{'USER'} ),
: exists $ENV{'LOGNAME'} ? $ENV{'LOGNAME'}
: $ENV{'USER'}
$species, $dbtype, $date, $time
if (my $path = $self->_db_path($self->dbi_connection)) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment