From c84a78e61002a9cf73ede8189d876c44d6059c7f Mon Sep 17 00:00:00 2001 From: "renater.salaun" <renater.salaun@047e039d-479c-447e-8a29-aa6bf4a09bab> Date: Fri, 3 Oct 2014 09:52:39 +0000 Subject: [PATCH] move DB details to the configuration file git-svn-id: https://svn.geant.net/GEANT/edugain_testidp_account_manager/trunk@13 047e039d-479c-447e-8a29-aa6bf4a09bab --- bin/create-database.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/create-database.pl b/bin/create-database.pl index d4684b1..c464be9 100755 --- a/bin/create-database.pl +++ b/bin/create-database.pl @@ -1,22 +1,25 @@ #!/usr/bin/perl ## Initialize Rose::DB code given the DB structure +use lib "/opt/testidp/IdPAccountManager/lib"; + use Rose::DB; use Rose::DB::Object::Loader; use Getopt::Long; +use IdPAccountManager::Conf; my %options; unless (&GetOptions(\%options, 'database=s')) { die "Unknown options."; } -my $dbname = $options{'database'} || 'idp_account_manager'; +my $dbname = $options{'database'} || $IdPAccountManager::Conf::global{'database_name'}; $loader = Rose::DB::Object::Loader->new( - db_dsn => "dbi:mysql:dbname=$dbname;host=localhost", - db_username => 'idpadmin', - db_password => 'PQur;m9#I[', + db_dsn => 'dbi:'.$IdPAccountManager::Conf::global{'database_type'}.':dbname='.$dbname.';host='.$IdPAccountManager::Conf::global{'database_host'}, + db_username => $IdPAccountManager::Conf::global{'database_user'}, + db_password => $IdPAccountManager::Conf::global{'database_password'}, db_options => { AutoCommit => 1, ChopBlanks => 1 }, class_prefix => 'IdPAccountManager::Data', #with_unique_keys => 0, @@ -26,3 +29,5 @@ $loader->make_modules(with_managers => 1, module_dir => '/tmp', #with_relationships => ['one to many','many to one'] ); + +printf "Database-related code created in /tmp/IdPAccountManager. You should copy this code in lib/ directory\n"; \ No newline at end of file -- GitLab